I want to choose one of three chunks of code in r.
How can I program it?
I want to choose one of three chunks of code in r.
How can I program it?
I would store these chunks in different files, e.g. part1.R, part2.R, part3.R, then you can start these scripts from within the other script:
# Run this line if you want to process your data with strategy 1
source(file = part1.R)
# or run this line if you want to process with strategy 2
source(file = part2.R)
I guess this can be done programatically as well:
if (condition1 is met) {
source(part1.R)
} else if (condition 2 is met) {
source(part2.R)
}
...
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
If you have a query related to it or one of the replies, start a new topic and refer back with a link.