[R] R with command line

Duke duke.lists at gmx.com
Wed Apr 28 17:11:55 CEST 2010


On 4/28/10 10:16 AM, peter dalgaard wrote:
> On Apr 28, 2010, at 4:03 PM, Duke wrote:
>    
>> I just did it, and it said it ignored the arg:
>>
>> $ R R_PROFILE_USER=try.R
>> ARGUMENT 'R_PROFILE_USER=try.R' __ignored__
>>      
> ...
>    
>>>        
>> What am I doing wrong?
>>      
>
> Using Windows syntax on a Unix machine.... (Duncan got confused)
>
> It's the other way around:
>
> peter-dalgaards-iMac:tmp pd$ echo "print('Hello, World')">  infile.R
> peter-dalgaards-iMac:tmp pd$ R_PROFILE_USER=infile.R R -q
> [1] "Hello, World"
>    

Thanks Duncan and Peter. This works fine now. But my script does not, 
since it still says *cannot find x11*, even though running with CMD 
BATCH is fine:

$ R_PROFILE_USER=try.R R -q
Error: could not find function "x11"
 > q()
Save workspace image? [y/n/c]: n
$ R CMD BATCH try.R

Anyway, it helps me understand what Duncan meant, and it is not what I 
wanted. I wanted to create a program, which can be run from command 
line, call R, show graphics, and give me the command prompt back. It can 
be done with a *&* at the end, but again:

$ R_PROFILE_USER=try.R R -q &

gives error, and

$ R CMD BATCH try.R & just show the pics for a moment, and close :(.

Thanks,

D.

>>      
>
>
>



More information about the R-help mailing list