'How to run segments of specific R code without running them before?
I'm writing a R script for colleagues to use. They load in their original datas as DF (all with the same name) and then they can run different statistical calculations and analysis on it. My colleges are not used to operating with R. So i want to make it as simple as possible for them. So my idea was to write the statistical calculations and analyses in to different sections of the code. At the beginning of the R script i would tell them to run lines from 10 to 20 to calculate average wage of the people in the DF, run code from lines 20 to 30 calculate correlation between level of education and wages and so on. They would just have to go to the lines mentioned make them active and press run.
In my real life code the calculations are more complex then i wrote here, but this is to give you an example of what i wanted to do.
Then I started to think could I write to so that if they run a singe command then that tells R to go and run codes from 10 to 20. And a different command tell's R to go and run codes on lines 20 to 30. I could not figure out how to do it. I looked at functions but this would require my college to run all of the code first anyway and defeat the purpose of the function in this case.
Is there a way to do it and if so then how?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
