# R Guide for psurvey.analysis_2.9

Downloading, Starting, Installing and Starting psurvey.analysis, R Introductory example, Script EditorsDownload R Guide2.9 (pdf 29KB)

**What is R?**

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 modelling, 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 on a wide variety of UNIX platforms and similar systems (including FreeBSD and Linux), Windows and MacOS." (from "The R Project for Statistical Computing" web page)

**Downloading R**

The R statistical analysis program (version 2.2.1) is available for downloading from this site.
The EMAP Design Team has __not__ verified that the current versions of psurvey.design (2.2.1)
or psurvey.analysis (2.9) are compatable with the several versions of the R Statistical Software.
The Team has developed and executed these versions using R 2.2.1. Use of R version 2.2.1 is highly
recommended and is available for download from this website.The process for downloading and installing follows.

R may be started from the Start Menu or from the Desktop icon. An important aspect in using R is to keep different projects on which you are working separated. We recommend that a separate folder be created for each project.

To configure R for use with a project, proceed as follows:

Start R, from the File pulldown menu, select Change Dir, and browse to the project folder. These steps will need to be repeated each time R is used for that project.

Alternatively,

**Installing and using R library: psurvey.analysis**

A Word document with an annotated copy of the R session, R script and data file are provided to illustrate several of the R commands that are used to read, modify and select data. Download the example, r_intro_exam (zip 212KB), unzip, start R, change directory, load psurvey.analysis, open the R script file (R_Script_Intro.R) and run each segment to illustrate the commands, while following the annotated document (R Introduction.doc).

Using the R script capability or a text editor is recommended for use in conjunction with R. Placing all R commands used in a script or text file will document how the analysis was completed. If necessary, the commands can be re-executed to duplicate any result or to redo an analysis if data has changed.

An advantage to using R script is the ability to highlight commands and execute them by
clicking on the "run line or selections" icon on the menu bar.

One text editor that is tailored for use in connection with R and SPlus is TINN-R.
It has a toolbar that sends script to R, lists arguments for R functions, sources files, lists contents for R objects,
opens help files among other things. Highlights text for R commands, comments, identifies () matches, etc.
It is a free download from sciviews.

Notepad is available within Windows as one option.
Another option is to download NoteTab Light from the NoteTab web site: Notetab.