R script works