[R] batch file execution

Uwe Ligges ligges at statistik.uni-dortmund.de
Sat Oct 15 19:03:30 CEST 2005


jun xu wrote:

> Thanks for all your (ronggui, *Uwe Ligges , **sosman) *help. I got it
> through using source. I know R has gone through all those lines, but I
> didn't get results of what I would if I use drop-down menu and click "run
> all" under edit after I open a script file? Basically, nothing hasspens
> except that no error message. My codes are very simple,
> 
> help(lm)
> library(foreign)
> mydta <-read.dta('h:/data/binlfp2.dta')
> mydta[1:5,]

Don't forget to print():

print(mydta[1:5,])

Uwe Ligges



> 
> Are the log results saved somewhere else automatically? Thanks again.
> 
> On 10/15/05, Uwe Ligges <ligges at statistik.uni-dortmund.de> wrote:
> 
>>sosman wrote:
>>
>>>jun xu wrote:
>>>
>>>
>>>>I am new to R and really like to get a handle of basics in short period
>>
>>of
>>
>>>>time. What I am trying to do is get myself a list of must-do's (read in
>>>>data, batch execution, delimiters, basic modeling commands) in R as in
>>
>>Stata
>>
>>>>or SAS. I am just wondering how to execute a R batch file in RGui.
>>
>>Suppose I
>>
>>>>have a script file (like do file in stata, or sas file in SAS) under
>>>>c:\whatever.R, how can I execute it using commands (not drop down menu)
>>
>>in
>>
>>>>RGui? In stata, would be something like
>>>
>>>
>>>If I am not mistaken the command is:
>>>
>>>>source("whatever.R")
>>
>>... or source("c:/whatever.R") if "c:\" is not your current working
>>directory.
>>
>>
>>>>do c:\whatever.do
>>>>How about in R. I tried the "R CMD BATCH('h:/whatever.R'), but it
>>
>>didn't
>>
>>>>work. Any help would be greatly appreciated.
>>
>>
>>R CMD BATCH has to be executed from the Windows shell (looks like you
>>are running this OS) rather than from within R with the Syntax (if
>>called from c:\ and R is in your PATH):
>>R CMD BATCH whatever.R
>>
>>Uwe Ligges
>>
>>
>>
>>
>>>paul sorenson
>>>
>>>______________________________________________
>>>R-help at stat.math.ethz.ch mailing list
>>>https://stat.ethz.ch/mailman/listinfo/r-help
>>>PLEASE do read the posting guide!
>>
>>http://www.R-project.org/posting-guide.html
>>
>>
>>
> 
>




More information about the R-help mailing list