This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: Introduction to R R is a general-purpose computer language. It is similar to S language, and much code written for S run unalterd under R. Its particular strength is in statistical, graphical capabilities. You can also do simple simulation with R. R is free : its nothing to do with free as in beer. You get free dom to do whatever with R! So once you learn R, R will not disappear like a lot of other commercial products. Some users think of R as a statistics system, but it is more of an environement within which statistics can be implemented. Capability of R can be easily extended by packages . There are many user-contributed packages which convers a wide range of modern statistics . These extra packages can be downloaded from The Comprehensive R Archive Network (cran): http://cran.us.r-project.org/ . R runs on Linux, Mac, and Windows. Home page: http://www.r-project.org/ Goto http://www.faculty.uaf.edu/ffnt/teaching/popgen/R-tutorial/R-tutorial.html for the online version of this doc- ument. 1 Installation For Mac OS-X, go http://cran.us.r-project.org/bin/macosx/ , and click R-x.x.x.dmg (x.x.x is a version num- ber). Double click the downloaded disk image, and double click R.mpkg, and follow the instructions. For Windows, go http://cran.us.r-project.org/bin/windows/base/ , click Downlad R x.x.x for Windows, and follow the direction of installer. I dont know much about Windows, but it was pretty simple. Linux users probably know how to install R (e.g., yum install R in Fedora/CentOS). 1.1 Packages R is modular, and you can enhance the functionality of R by using Contributed packages in CRAN (http://cran.us.r- project.org/web/packages/). To install these extra packages, you can see the Section 6 of R Installation and Administration (http://cran.us.r-project.org/doc/manuals/R-admin.html). One way of installing packages are using install.packages() inside of R. &gt; install.packages(&quot;ape&quot;, dependencies = TRUE) This will automatically download and install the package ape. To use the package, &gt; library(&quot;nlme&quot;) Note that package nlme is included in the default installation, so you did not need to install it before you use it. 1 2 Basics: Importing data 2.1 From spread-sheet (e.g. OpenOffice.org and Excel) Easiest to transfer the data by converting the data into a simple text file. For example, spread-sheet can export the data to comma-delimited (CSV) or tab-delimited text files. tab-delimination is probably better because if some cells contains comma as a part of the data, column alignment may get screwed up with CSV. Steps in spread-sheet 1. Select the sheet which contains the data 2. Clean up the data If your data contains clumn header, make the first row to be the column header....
View Full Document
This note was uploaded on 06/06/2011 for the course STAT 4360 taught by Professor Park during the Spring '11 term at UGA.
- Spring '11