Suppose I create an R program called myTest.R with only one line like
the following:
type <- as.integer(readline("input type (1: type1; 2: type2)? "))
Then I'd like to run myTest.R in batch mode by constructing an input
file called answers.R with the following:
source("myTest.R")
1
When I ran the following at the terminal:
R CMD BATCH answer.R output.Rout
it failed to pick up the answer '1' from the 2nd line in answers.R as
shown inside output.Rout:
> source("myTest.R")
input type (0: quit; 1: type1; 2: type2)?
> 1
[1] 1
What am I missing here?
Thanks in advance,
Gang
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.