[R] Using command line --file or -f

Erik Iverson eriki at ccbr.umn.edu
Wed Aug 11 22:23:55 CEST 2010



Gene Leynes wrote:
> *What I want to do:
> *Create a windows shortcut that will start the R gui  **and**
> simultaneously source a file
> 
> *What I have already tried:
> *This almost works, but it's not the interactive R GUI:
>      R --no-save --sdi -file="C:\SomePath\example.R"
> These open the R GUI, but doesn't recognize -f --f --file -file
>      RGUI --no-save --sdi -file="C:\SomePath\example.R"

Shouldn't that be --file=... (i.e., with 2 dashes)

>      RGUI --no-save --sdi -f "C:\SomePath\example.R"
>      I've thought about suppressing the error and then parsing
> commandArgs()...

Which error?  I don't see one.

I don't have Windows to test on, so this is a shot in the dark.
Do you have to double-backslash escape the file path?

>      Although this may be possible, it seems preposterously overly
> complicated.
> 
> *My last resort:
> *   Having an entire installation of R with a "Rprofile.site" that will
> source my program.  The whole installation would be devoted to just running
> that one program.  I think it will work, but it's an annoying waste of
> space, and confusing to have multiple R installation.
> 
> 
> Thank you very much!
> 
> 
> What I'm using:
>    Right now, R 2.10 on Windows 7, but I'm happy to use any version.  My
> intended audience will be using Windows 7
> 
> I've spent a fair amount of time searching the online help using my favorite
> help sites:
> http://r-project.markmail.org/
> http://r.789695.n4.nabble.com/R-help-f789696.html
> 
> I've also looked at the PDFs that come with r, especially the R-intro (which
> is where I got the --f and --file ideas).
> 
> Sometimes I see help responses that just point to the chapter of a book, or
> a PDF on Cran.  I would be delighted to discover my own answer in the
> available materials, but please give some hint about why the cited material
> is relevant!
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at 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.



More information about the R-help mailing list