|
The
CSCAR Guide to Obtaining and Installing R
The R
Project Web Page
At
the R Project Web Page (http://www.r-project.org), you will find a variety of
information about the R Project, which you can peruse
at your leisure. The most important link will appear
at the left hand side of the screen, under the
“Download” heading. Click on the CRAN link
(Comprehensive R Archive Network), and after you
choose one of the U.S. mirrors (http://cran.stat.ucla.edu/
is recommended), you will be taken to the page that
you will use to download everything R-related.
Once you
find the CRAN web page, take the following steps to
obtain R:
1.
Click on
the “R Binaries” link on the left-hand side of the
page under the “Software” heading.
2.
Click on
the folder that best describes your operating system.
3.
When using
Windows, click on the “base” subdirectory. This will
allow you to download the base R package.
4.
Click on
the rwXXXX.exe link. R is updated quite frequently,
and the version number is always changing. Save the
.exe file somewhere on your computer.
5.
Double-click on the .exe file once it has been
downloaded. A wizard will appear that will guide you
through the setup of the R software on your machine.
6.
Once you
are finished, you should have an R icon on your
desktop that gives you a shortcut to the R system.
Double-click on this icon, and you are ready to go!
Adding Packages to R
At step
3 above, you also have the option of clicking on
“contrib” subdirectory. Doing this will allow you to
download additional contributed packages in R. So
what exactly are “additional contributed packages”?
R is an open source
software package, meaning users of R are free to
explore the code behind the software and write their
own new code. Several statisticians and researchers
have written additional packages for R that perform
complex analyses which are not very common, and in
order to use these packages, you need to first
download them. The base R package comes with several
additional packages, but odds are that you will
discover an uncommon analysis technique in your
research that requires you to install an additional
package that is not available with the base package.
There are many additional packages…don’t hesitate to
explore the contributed packages to see if someone has
developed a package that will allow you to implement a
technique that you are interested in!
To
download contributed packages, follow steps 1 and 2
above, and then click on the “contrib” link. Then,
follow these steps:
1.
Scroll
through the list of contributed packages (in .zip
format), and click on the package that you would like
to download. You can find descriptions of all of
these contributed packages and the techniques
implemented within them by clicking on the “Package
Sources” link under the “Software” heading on the CRAN
web page. This page will also have links to help
manuals for the packages.
2.
Save the
.zip file in the …\R\rwXXXX\ folder that was created
on your machine when you installed R. Usually, this
directory will be C:\Program Files\R\rwXXXX\.
3.
Open the
.zip file, and extract the folder containing the
package (the name of this folder will be the name of
the package) into the “library” folder that should
exist in the …\R\rwXXXX\ folder (the same folder where
you saved the downloaded .zip package).
4.
The
package will now be ready to use when you start R!
FAQ’s
on the CRAN Web Page
Under
the “Documentation” heading on the left-hand side of
the CRAN web page, click on the “FAQs” link. This
will allow you to see an FAQ page that will answer
many of the most commonly asked questions about R.
You will find that this section will provide answers
to many of your questions, whether they are simple or
difficult.
Searching on the CRAN Web Page
Under
the “CRAN” heading on the left-hand side of the CRAN
web page, you can click on the “Search” link.
Although there is no formal search engine on the CRAN
web page, this will take you to a set of links
allowing you to search the R archives (manuals, mail,
help files, etc.) for anything that you would like.
This is often useful if you are faced with a tough
analysis question, and you want to see if another R
user has addressed the question before.
Starting R
At this
point (if you haven’t already), you should be able to
start R! If you asked for a shortcut to R to be
created on your desktop, simply double click on the R
icon to start R. This will open the R GUI (Graphical
User Interface). You should see a window inside the R
GUI containing the R Console. This is where you will
specify all of your commands and programs
interactively, at the red command prompt.
When
you submit a command to R, you will either see nothing
but another command prompt (good), a result (good), or
an error message (bad).
You are
now ready to use R!
|