Added definitions for R functions in file