Combine and run multiple R script s from another script

In fact, I built a significant predictive model in R with approximately 10 ~ 15 separate script files for collecting, sorting, analyzing, and presenting my data. Instead of just putting everything in one giant script file, I would like to maintain some level of modularity and run each part from a script control or some comparable control mechanism, as I already did in MATLAB. Is this possible in R?

I read this thread, as well as related topics, but could not find this exact answer. Organization of the source code R

+6
source share
2 answers

I think you are looking for the source function. See ?source . Usually I have a script wizard that source other .R files.

+7
source

Although I understand your need for modularity, why not just create one script for interest. Selecting multiple scripts leads to difficulties in being unable to pass variables in scripts, unless you write files (which lose processor cycles). You can even create a script wizard that will read the text contents of each script, and then create a script wizard, and then run the script.

0
source

Source: https://habr.com/ru/post/973720/


All Articles