Hello, I am interested in passing a command or two to R on the command line. The desired behavior is for R to run these commands first, and then begin an interactive session. For example:
$ R -e 'foo <- read.csv("/tmp/foo.csv")' ...which would launch R and execute that command, so when I return from getting coffee, foo would be loaded. I know that if I put this command into my .Rprofile, it will execute as desired, but I'm looking for something a bit more modular. I have tried the following: $ echo '10*5' | R ...fails unless I specify --save --no-save or --vanilla. I choose the latter; R prints 50 and quits...but I do not want it to quit! $ echo '10*5' | R --interactive ...fails in an interesting way: I get an infinite loop of Save workspace image? [y/n/c]: Save workspace image? [y/n/c]:, etc. I have to kill R in another window. This also happens with $ echo '10*5; scan()' | R --interactive ...even though I'd expect scan() to prompt for input. If I specify $ echo '10*5; scan()' | R --interactive --vanilla ...then R just prints 50 and quits. Is this a bug with "interactive?" The description of "Force an interactive session" is not informative enough for me to have any further guess as to what to do here, but my expectation is that it would make R not auto-quit. ...perhaps I don't know how to use --interactive properly? Could somebody point me on the right track? Googling for "R --interactive" is nigh untu useless. :-\ This behavior is present in R 2.9.2 and 2.10.0. Many thanks! Cordially, Adam Kramer ______________________________________________ R-help@r-project.org 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.