moving R code to models dir