refactored R script and wrapper script into one
cleaned up use generic R calling function
cleaned up to work with updated python