Update linear hetero and grouping wrapper function

* Use the correct output column name

* Added all R script related files into R directory