by David Lillis, Phd.
Many of you have heard of R (the R statistics language and environment for scientific and statistical computing and graphics). Perhaps you know that it uses command line input rather than pull-down menus. Perhaps you feel that this makes R hard to use and somewhat intimidating!
OK. Indeed, R has a longer learning curve than other systems, but don’t let that put you off! Once you master the syntax, you have control of an immensely powerful statistical tool.
Actually, much of the syntax is not all that difficult. Don’t believe me? To prove it, let’s look at some syntax for providing summary statistics on a continuous variable.
First, install R by going to the following web-site:
Now you can download R by clicking on the following link:
OK, so you have successfully downloaded R. Now you should have the R icon on your desktop. Click this icon to open R.
Now for a simple exercise. Let’s take height to be a variable that describes the heights (in cm) of ten people. Copy and paste the following code to the R command line to create this variable.
height = c(176, 154, 138, 196, 132, 176, 181, 169, 150, 175)
The variable is now stored in the R workspace. To view this variable, enter:
Now, enter the following code at the command line and hit return after each piece of code. You will be surprised how easy this really is!
So - it really wasn’t that difficult after all. More about R later.
If you want to learn all about linear regression in R, check out our upcoming 4-hour workshop on the lm() function in R for fitting linear models. Click here for more info on the Linear Regression in R workshop.
About the Author: David Lillis has taught R to many researchers and statisticians. His company, Sigma Statistics and Research Limited, provides both on-line instruction and face-to-face workshops on R, and coding services in R. David holds a doctorate in applied statistics.