Hi. I am a newbie to R. I need to do a courses projects with some manipulation lots of data record and some back-and-forth linear regression. I do not want to spend $100 for a SAS lincence, which professor used. So I decide to start to learn R to finish it. I am using R in Windows. I feel it is somehow works like mathemica. I try to write the work into a little program for future reference. (My data soon exceeds the workplace.) So that should be a script, right? Then I can load it in "file/source R code". One thing puzzles me is that how to write comments in the script. I googled internet and the archive and did not find any clues. First, can anyone confirm that I took the correct approach for the problem? I understand R is quite different from program language like C/Pascal which I am familiar with and seems people write it with quite different style. Second, can anyone show me some idea about how to write the comment. Thanks.
Guojun Zhu wrote:>Hi. I am a newbie to R. I need to do a courses >projects with some manipulation lots of data record >and some back-and-forth linear regression. I do not >want to spend $100 for a SAS lincence, which professor >used. So I decide to start to learn R to finish it. >I am using R in Windows. I feel it is somehow works >like mathemica. I try to write the work into a little >program for future reference. (My data soon exceeds >the workplace.) So that should be a script, right? >Then I can load it in "file/source R code". One thing >puzzles me is that how to write comments in the >script. I googled internet and the archive and did >not find any clues. > >First, can anyone confirm that I took the correct >approach for the problem? I understand R is quite >different from program language like C/Pascal which I >am familiar with and seems people write it with quite >different style. Second, can anyone show me some idea >about how to write the comment. Thanks. > >It seems a good idea to me to add all your commands in a script and to source it in order to execute it. Comments can be added in R simply by starting a line with a # Greetz, Dirk -- Dirk De Becker Work: Kasteelpark Arenberg 30 3001 Heverlee phone: ++32(0)16/32.14.44 fax: ++32(0)16/32.85.90 Home: Waversebaan 90 3001 Heverlee phone: ++32(0)16/23.36.65 dirk.debecker at biw.kuleuven.be mobile phone: ++32(0)498/51.19.86 Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm
2006/4/26, Guojun Zhu <shmilylemon at yahoo.com>:> Hi. I am a newbie to R. I need to do a courses*do* have a look at e.g.: - http://cran.r-project.org/manuals.html (An Introduction to R) - http://www.ms.unimelb.edu.au/~andrewpr/r-users/icebreakeR.pdf (contributed manual) - http://cran.r-project.org/doc/contrib/Short-refcard.pdf (reference-card) to search the archives you can use: - http://tolstoy.newcastle.edu.au/R/about.html - http://finzi.psych.upenn.edu/search.html> I am using R in Windows.Have a look at Tinn-R (editor)> like mathemica. I try to write the work into a little > program for future reference. (My data soon exceeds > the workplace.) So that should be a script, right?yes> Then I can load it in "file/source R code".source( "yourScript.R" ) check working path: getwd() if you don't know what this is: ?getwd ?source> First, can anyone confirm that I took the correct > approach for the problem?yes I understand R is quite> different from program language like C/Pascal which I > am familiar with and seems people write it with quite > different style.it's a functional language and inherits from LISP (Scheme). You need to read the manual.>Second, can anyone show me some idea > about how to write the comment. Thanks.# this is a comment -- Regards, Hans-Peter