cleaned up R script - still need to finish code book