
Link to the last RSS article here:
Speaking of Stata - Ed.
R for the Windows Platform: Installation and
Configuration
By Dr. Rich
Herrington, Research and Statistical Support Services Manager
This
month we demonstrate how to download and install the GNU S statistical
system "R", for the Microsoft Windows platform. The following is an
excerpt from the R website
http://www.r-project.org - "R is a language and
environment for statistical computing and graphics. It is a
GNU project which is
similar to the S language and environment which was developed at Bell
Laboratories (formerly AT&T, now Lucent Technologies) by John Chambers
and colleagues. R can be considered as a different implementation of
S. There are some important differences, but much code written for S
runs unaltered under R. R provides a wide variety of statistical
(linear and nonlinear modeling, classical statistical tests,
time-series analysis, classification, clustering, ...) and graphical
techniques, and is highly extensible. The S language is often the
vehicle of choice for research in statistical methodology, and R
provides an Open Source route to participation in that activity. One
of R's strengths is the ease with which well-designed
publication-quality plots can be produced, including mathematical
symbols and formulae where needed. Great care has been taken over the
defaults for the minor design choices in graphics, but the user
retains full control. R is available as Free Software under the terms
of the Free Software
Foundation's GNU
General Public License in source code form. It compiles and runs
out of the box on a wide variety of UNIX platforms and similar systems
(including FreeBSD and Linux). It also compiles and runs on Windows
9x/NT/2000 and MacOS" (from Introduction).
Downloading and Installing R

Under Precompiled Binary Distributions, the Windows (95
and later) bullet is the hypertext link for downloading the binary
version of R. The base subdirectory has the main R self-extracting
executable file in it:

Clicking base hypertext link gives the screen:

The rw1071.exe file can be save to your local desktop by a "right
mouse-click" on the rw1071.exe hypertext link. Select "Save
Target As.."; browse the file system to find the Desktop and then
"Save".

There should be an
icon on your Desktop. Double clicking this icon should give the
following installation screen.

Select the
Next button. After reading the GNU
licensing agreement, if you agree, continue to choose the default
selections in the installation window. If installation is proceeding
properly, you will see the following installation screen. Once
installation is finished, an R icon will be placed on the Desktop.

As of version 1.7.0, the R installation file installs the Tcl/Tk
system. The Tcl/Tk system allows programmers to build general GUIs
for entry level R users. A discussion of the potential uses of this
interface in R can be found at:
http://www.ci.tuwien.ac.at/Conferences/DSC-2001/Proceedings/Dalgaard.pdf
Installing Libraries in R
After downloading and installing R, we will want to download and
install libraries that are available on R CRAN website. Double click
the R icon on your desktop and you should see the following screen:
You will need a fast internet connection to download these
libraries. Select the Packages option on the main menu bar,
then select Install package(s) from CRAN. The following screen
should appear:

Using the "ctrl" key ( the control key), one can multiply select
those libraries that are to be installed. To install the Rcmdr
library, scroll down the window and select "Rcmdr". Delete the
downloaded archive files by responding "yes" at the question prompt.
R then configures the html help pages.

The Rcmdr or "R Commander" library is a simple menu system based on
Tcl/Tk. The following excerpt are taken from the author's webpage
at:
http://www.socsci.mcmaster.ca/jfox/Misc/Rcmdr/index.html .
"The R-Commander GUI consists of a window containing several menus,
buttons, and information fields. In addition, the Commander window
contains a log/script box. The R-Commander menus are easily
configurable through a text file. The menus lead to simple dialog
boxes, the general contents of which are more or less obvious from the
names of the menu items. These boxes have a common structure,
including a help button leading to the help page for a relevant
function. Commands generated via the dialog are posted to the R
session window, along with printed output, and to the log window.
Lines in the log window may be edited and (re)submitted for execution.
Commands access a current or active data set (data frame). When a new
data set is read (from an attached package or imported), it becomes
the active data set. The user can also select an active data set from
among data frames currently in memory. In addition to standard
packages, the Commander uses some functions in my car package.(The
scatterplot and scatterplot.matrix functions in the car package, prior
to version 1.0-5 of car, generate warning messages in R 1.7.0 and
above. This is not a problem specific to the Commander and will go
away if you update car.). My object in designing and implementing this
GUI was to cover the content of a basic-statistics course. The target
text was Moore's The Basic Practice of Statistics, Second Edition
(Freeman, 2000), which is the text that I currently use for a
two-semester introduction to statistics for undergraduate sociology
majors. The R Commander implements the content of this text plus some
additional material (e.g., linear and generalized linear models). As a
result of several suggestions that I have received, the coverage is
now larger than originally envisaged (quoted from John Fox's Rcmdr
webpage).
Loading a Library in R
To use the Rcmdr library, we will want to configure the R system
window to have a "single document interace" mode. Right mouse click
the R icon on your desktop and select properties. Add " --sdi
" to the Target field after the Rgui.exe statement (see below). Click
apply, then ok. Double click the R icon on your desktop
to start the R system.

To load a library in R, select Packages from the main menu
bar and select Load Package. Select the Rcmdr library in the
package selection window. The following menu system will appear:

To import an SPSS data set:

Give the imported data set a working session name, then browse the
file system to select your SPSS data set.

In the main SPSS directory there should be a data set called "Cars"
(this dataset ships with SPSS).

Select the data file. Next, go to Graphs and select Scatterplot
Matrix. Select MPG, ENGINE, and HORSE. Next, select OK.

You should see the following:

Selecting History on the plot window will keep a history of
previous plots. You can access previous plots by using the "page up"
and "page down" key.
Next Time
Next time we will explore in more detail the Rcmdr library for
windows.
References
Dalgaard, Peter (2002). Introductory Statistics with R.
Springer: New York.
Fox, John (2003). The R Commander: A Basic-Statistics GUI for R.
http://www.socsci.mcmaster.ca/jfox/Misc/Rcmdr/index.html
RSS News
Research consulting duties change hands
We have a new
face in the RSS office! Mike Clark has
replaced Garvii Thomas as a research consultant in the RSS
office. Mike comes to us with quite a bit of research experience
developed during his tenure as a graduate student working on his
PhD in Experimental Psychology. Mike graduated with a double
undergraduate degree in psychology and philosophy. Mike
continued his education, becoming a graduate student here at
UNT. He has taught undergraduate statistics and graduate
statistics labs as part of his graduate student experience, and
continues to consult with graduate students on research
projects. Let us all give Mike a warm welcome, and bring the
research on!
"SAS Corner" combined with "RSS Matters"
We have decided
to combine these two columns. "RSS Matters" will cover SAS
topics as well as other research and statistical topics.
|
|