updated to R scripts