Learning RMatthew KracheyCHAPTER 1Session # 11. IntroductionR (http://www.r-project.org) is a free, open source statistical software package basedon the S programming language. In contrast to SAS, R is a scripted language. That is,you can make decisions on the y, and manipulate them in real time, in contrast to SAS.R also has a great graphical package, which will be the subject of later talks.R is based on the S language, which has a cousin S-plus, which has some dierences,but is essentially a version of R that you pay for. Industry often does, but I can’t thinkof many researchers that do anymore.2. ScriptsGo to le: new script. This generates a script le. Select text in the script le, hitctrl-R, and it will send the text to R. This is a helpful way to keep your code organized,work, modify code, and end up with what you want.Popular alternatives to the script editor include Tinn-R, ESS, and my prefered, Eclipseusing the StatET package.3. ObjectsR treats everything as objects. Objects can be numbers, text, n-dimensional matrices,vectors, programs, output, etc. For example, suppose we wanted to assign the string ofintegers from 1 to 10 to the variable x. Then> x = 1:10> x[1] 1 2 3 4 5 6 7 8 9 10First, note that here the = is playing the role of theassignment operator, it is takingwhat is on the right side of the sign, and shoving it into what is on the left side. Notethat if I want to see if two variables are equal, I cannot use the symbol = ...
Voir