here are the R scripts