Reputation: 489
I have a file called Functions.R where I have saved all my functions. I normally import this file into my R scripts using:
source("E:/R Scripts/Functions.R")
Is there a way to only import the function/functions I need, maybe as extra parameter in the source command. When I run the line above, all the functions get imported into my RStudio and I normally only need one.
Upvotes: 1
Views: 186
Reputation: 270318
Break up functions.R into multiple files which each have some of the functions. Then replace functions.R with a file which sources each of those files. If you want all functions just source functions.R like you do now or if you want some of them just source the appropriate file.
Another approach is the klmr modules package on github (google it) that provides a module system that you could consider.
Upvotes: 3