I'll respond to everyone, but Duncan's response worked, so I'll put that
first.  Thank you *everyone* for responding, I really appreciate it


Duncan:
Great idea, it's simple and works.  Using the --args causes the final flags
to be ignored by R, but you can still retreive them using commandArgs()

The windows shortcut looks like this:
Q:\somewhere\FolderForRStuff\R-2.10.1\bin\Rgui.exe --sdi --no-save --args
StartTheGUI

and I added this line to the bottom of the Rprofile.site
if(commandArgs()[5]=="StartTheGUI")
    source('Q:/somewhere/FolderForRStuff/someproject/StartGUI.R')

Also, about the "R_PROFILE_USER" part... I read about that earlier, and was
thinking of using that approach, but I wasn't sure about some of the
details, like where you do the assignment, etc.  I appreciate you mentioning
it because I may need to use it down the road.  Also, hopefully for future
searchers of the r-help-list, this may give them more options to consider.


Erik:
Yes, that should be two dashes.  These both execute (but without a GUI)
R --no-save --sdi --file="C:\somepath\example.R"
R --no-save --sdi -f "C:\somepath\example.R"

This command generates starts the R gui
RGUI --no-save --sdi -f "C:\SomePath\example.R"
but, also has the errors that appear in windows popups:
(windows pop-up "WARNING: unknown option '-f' ")
(windows pop-up "ARGUMENT: 'C:\somepath\example.R' __ignored__  ")
Then the R GUI starts without loading anything.

David:
I meant to mention that google project.  I've spent a lot of time looking at
it, and I haven't gotten much use out of it.  With the right background that
project might be very useful, but at my stage it's too complicated and
hasn't been worth the time.

If you associate R files with the Rgui.exe you get the second windows error
above, and the R GUI starts without loading anything.  There is probably
something possible to get R files to open in R (either to edit or with a
"source" command), but I have not found it yet.


On Wed, Aug 11, 2010 at 3:37 PM, Duncan Murdoch <murdoch.dun...@gmail.com>wrote:

> On 11/08/2010 4:13 PM, 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"
>>     RGUI --no-save --sdi -f "C:\SomePath\example.R"
>>     I've thought about suppressing the error and then parsing
>> commandArgs()...
>>     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.
>>
>
> A much simpler approach would be to create a script file of some sort that
> takes the name of the file, sticks it into the environment variable
>  R_PROFILE_USER, then starts Rgui.  If you've already got a user profile
> set, then I think you'll need to use one of your more elaborate schemes.
> I'd put the filename onto the Rgui command line after --args, then my user
> profile would use commandArgs() to check to see if anything was there and
> would source it.
>
> Duncan Murdoch
>
>
>>
>> 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@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.
>>
>
>

        [[alternative HTML version deleted]]

______________________________________________
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.

Reply via email to