Arun
Arun

Reputation: 625

How to call a R program from another R program?

Is it possible to call a R program with in a R program?

Say for example, I am looking for something like this:

If condition == X{
   CALL "Pgm A"
  } else {
     CALL "Pgm B"
 }

This kind of syntax I have used in C. Is there a way similar in R?

Thank you.

Upvotes: 13

Views: 22845

Answers (1)

Ujjwal Kumar
Ujjwal Kumar

Reputation: 581

This should do

if(condition==X){
    source("program_A.R")
}else{
    source("program_B.R")
}

Upvotes: 21

Related Questions