Greetings, I have just downloaded R onto a 64bit PC running Microsoft 7 Home Edition via Rgui. I have quite a bit of programming experience, though not as a professional programmer. I am a Measurement and Assessment professional (standardized testing). I would like to be able to write R scripts, and call them from the command line in Rgui. After two attempts, I receive the following error messages> R CMD BATCH test.RError: unexpected symbol in "R CMD"> Rscript test.RError: unexpected symbol in "Rscript test.R" These commands were taken directly from the R documents found on the R-project website. Clearly, I am doing something wrong. The script test.R resides in the R directory, and includes 24 + 6 and nothing more. The path to test.R is C:\Program Files\R\test.R Any assistance would be appreciated. Mark Russell, MEd MESA Quidquid Latine dictum sit altum videtur. [[alternative HTML version deleted]]
Hi, I do not use R for Windows. But I would say that you have to run 'Rscript.exe' in a "CMD" prompt, if I am not mistaken. Not in 'Rgui'. In 'Rgui', use 'source'. Hope this helps, Pascal On 05/29/2013 03:07 AM, Mark Russell wrote:> Greetings, > > > > I have just downloaded R onto a 64bit PC running Microsoft 7 Home Edition > via Rgui. I have quite a bit of programming experience, though not as a > professional programmer. I am a Measurement and Assessment professional > (standardized testing). I would like to be able to write R scripts, and call > them from the command line in Rgui. After two attempts, I receive the > following error messages > > > >> R CMD BATCH test.R > > Error: unexpected symbol in "R CMD" > > > >> Rscript test.R > > Error: unexpected symbol in "Rscript test.R" > > > > These commands were taken directly from the R documents found on the > R-project website. > > > > Clearly, I am doing something wrong. The script test.R resides in the R > directory, and includes > > > > 24 + 6 > > > > and nothing more. The path to test.R is C:\Program Files\R\test.R > > > > Any assistance would be appreciated. > > > > Mark Russell, MEd MESA > > > > Quidquid Latine dictum sit altum videtur. > > > > > [[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. >
On 28-05-2013, at 20:07, "Mark Russell" <gibsonsdad at cox.net> wrote:> Greetings, > > > > I have just downloaded R onto a 64bit PC running Microsoft 7 Home Edition > via Rgui. I have quite a bit of programming experience, though not as a > professional programmer. I am a Measurement and Assessment professional > (standardized testing). I would like to be able to write R scripts, and call > them from the command line in Rgui. After two attempts, I receive the > following error messages > > > >> R CMD BATCH test.R > > Error: unexpected symbol in "R CMD" > > > >> Rscript test.R > > Error: unexpected symbol in "Rscript test.R" > > > > These commands were taken directly from the R documents found on the > R-project website. > > > > Clearly, I am doing something wrong. The script test.R resides in the R > directory, and includes > > > > 24 + 6 > > > > and nothing more. The path to test.R is C:\Program Files\R\test.R > > > > Any assistance would be appreciated. >R CMD ? and Rscript are not run from within R itself. You probably got this from section B1 of the An Introduction to R manual. You run these commands in a Windows console window. In an interactive R session you use source(??.). ?source There is no need to put your scripts in the same directory where R is installed. Put them somewhere in your user space. Read the introductory manual starting from the first page:-) Berend
You probably want from windows GUI: source("test.R") To read help to learn about this command type: ?source at the command prompt. (Similar pattern get help on other commands too - its an important R skill/habit). If your are going to do a lot of script development, I would highly recommend you take a look at RStudio, http://www.rstudio.com/ide/download/ which is a front end for R that greatly streamlines script development and use. Rob On 5/28/2013 1:07 PM, Mark Russell wrote:> Greetings, > > > > I have just downloaded R onto a 64bit PC running Microsoft 7 Home Edition > via Rgui. I have quite a bit of programming experience, though not as a > professional programmer. I am a Measurement and Assessment professional > (standardized testing). I would like to be able to write R scripts, and call > them from the command line in Rgui. After two attempts, I receive the > following error messages > > > >> R CMD BATCH test.R > Error: unexpected symbol in "R CMD" > > > >> Rscript test.R > Error: unexpected symbol in "Rscript test.R" > > > > These commands were taken directly from the R documents found on the > R-project website. > > > > Clearly, I am doing something wrong. The script test.R resides in the R > directory, and includes > > > > 24 + 6 > > > > and nothing more. The path to test.R is C:\Program Files\R\test.R > > > > Any assistance would be appreciated. > > > > Mark Russell, MEd MESA > > > > Quidquid Latine dictum sit altum videtur. > > > > > [[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.-- Robert W. Baer, Ph.D. Professor of Physiology Kirksille College of Osteopathic Medicine A. T. Still University of Health Sciences Kirksville, MO 63501 USA
Second the RStudio but also suggest Tinn-R for a beginner as the more extenseve code highlighting can be very useful. John Kane Kingston ON Canada> -----Original Message----- > From: rbaer at atsu.edu > Sent: Wed, 29 May 2013 08:17:47 -0500 > To: gibsonsdad at cox.net > Subject: Re: [R] Rank Amateur Question > > You probably want from windows GUI: > > source("test.R") > To read help to learn about this command type: > ?source > at the command prompt. (Similar pattern get help on other commands too - > its an important R skill/habit). > > If your are going to do a lot of script development, I would highly > recommend you take a look at RStudio, > http://www.rstudio.com/ide/download/ which is a front end for R that > greatly streamlines script development and use. > > Rob > > > On 5/28/2013 1:07 PM, Mark Russell wrote: >> Greetings, >> >> >> >> I have just downloaded R onto a 64bit PC running Microsoft 7 Home >> Edition >> via Rgui. I have quite a bit of programming experience, though not as a >> professional programmer. I am a Measurement and Assessment professional >> (standardized testing). I would like to be able to write R scripts, and >> call >> them from the command line in Rgui. After two attempts, I receive the >> following error messages >> >> >> >>> R CMD BATCH test.R >> Error: unexpected symbol in "R CMD" >> >> >> >>> Rscript test.R >> Error: unexpected symbol in "Rscript test.R" >> >> >> >> These commands were taken directly from the R documents found on the >> R-project website. >> >> >> >> Clearly, I am doing something wrong. The script test.R resides in the R >> directory, and includes >> >> >> >> 24 + 6 >> >> >> >> and nothing more. The path to test.R is C:\Program Files\R\test.R >> >> >> >> Any assistance would be appreciated. >> >> >> >> Mark Russell, MEd MESA >> >> >> >> Quidquid Latine dictum sit altum videtur. >> >> >> >> >> [[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. > > > -- > > Robert W. Baer, Ph.D. > Professor of Physiology > Kirksille College of Osteopathic Medicine > A. T. Still University of Health Sciences > Kirksville, MO 63501 USA > > ______________________________________________ > 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.____________________________________________________________ GET FREE SMILEYS FOR YOUR IM & EMAIL - Learn more at http://www.inbox.com/smileys Works with AIM?, MSN? Messenger, Yahoo!? Messenger, ICQ?, Google Talk? and most webmails