Don't try to do too much in one session. You might like to just install R and then come back and do further steps such as going through the Venables and Ripley tutorial and installing libraries. Finally you will want to use project directories in which you keep data, scripts and other files pertaining to a particular project.
For a quick start, focus on the items that are marked QUICK START:.
Contents[hide] |
Installing R
Windows, Mac or Linux
QUICK START: To install R, you can go to the CRAN (Comprehensive R Archive Network website) and follow the instructions.You should consider installing RStudio, a recently released IDE (Integrated Development Environment) for using R that has gained rapid popularity.
You will eventually need to install additional packages which you can do easily whenever your computer is connected to the internet.
Further information
You can get more information on installing R and RStudio at John Fox's website.Starting to learn R: Tutorials on the Web
Start by working through sample scripts. This is probably the best way to start exploring and enjoying R without getting overwhelmed by long explanations.- QUICK START: Work through the sample scripts prepared by John Fox for his UCLA tutorial. R will reveal itself to you as you try them out. Print a copy of Tom Short's R reference card and read William Revelle's Using R for psychological research: A Simple Guide to an Elegant Package.
- A list of tutorials recently (January 2012) recommended on the LinkedIn blog The R Project for Statistical Computing:
- R tutorial at cyclismo.org
- UCLA's Academic Technology Services resources for learning R
- Quick-R
- The Georgia R School
- Official Introduction to R at CRAN. Start with the sample session in Appendix A.
- Vincent Zoonekynd's Statistics with R site
- R by Example
- Statistics, R, Graphics and Fun
- A short course in R by Thomas Lumley
- icebreakeR by Andrew Robinson
- Hadley Wickam's wiki (more advanced)
- A blog for useful ideas
- Finally if you're an experienced programmer just getting starting with R you might really enjoy The R Inferno by Patrick Burns
- An annotated list elsewhere on this wiki: R: R tutorials and courses.
- An extensive list of on-line books and tutorials is available from the CRAN site.
- Chris Green at the University of Washington has an excellent very accessible on-line book: Christopher Green: R Primer
- An introductory sample session: http://cran.r-project.org/doc/manuals/R-intro.html#A-sample-session
- The very basics from a tutorial at the University of Waterloo.
- The first chapter of Venables and Ripley adapted to R VR4: Chapter 1 summary. This is more of an introductory session than a tutorial. It gives a good overview of the potential in using R as well as introducing a number of interesting statistical ideas.
- The tutorial that comes with R[1] is extensive but gradually working through it might be the best way to become proficient.
- R tutorial at UCLA This is good but takes you through some things you won't really need.
- The start of a local tutorial (please contribute)
- If you are already familiar with SAS or SPSS you should have a look at Rob Munchen (2007) R for SAS and SPSS Users
Other interesting tutorials on the web
- An easy-to-follow introduction that shows how to fit simple regression and create few basic graphs
- Wikiversity: How to use R
- Using R for psychological research: A very simple guide to a very elegant package
- Notes on the use of R for psychology experiments and questionnaires by Baron and Li
- John Verzani's simpleR
- Statistical Computing course at Illinois State University
- A list of R resources for beginners partly copied from Ulrich Halekoh, Søren Højsgaard (March 2006) R Installation - getting the R program up and running it on Windows Version 4:
- The list of R documentation on the CRAN website.
- Petra Kuhnert and William Venables have an excellent 360-page textbook “An Introduction to R: Software for Statistical Modelling & Computing” that can be downloaded as a zip file. It contains extensive information on using Tinn-R and "Lab Exercises" in Appendix II.
- R for beginners by Emmanuel Paradis: http://cran.r-project.org/doc/contrib/Paradis-rdebuts_en.pdf
- Short introduction to the basic features of R. A good point to start.
- Simple R 2 by John Verzani: http://cran.r-project.org/doc/contrib/Verzani-SimpleR.pdf
- Introduction to R with a lot of statistical examples
- An Introduction to R: Software for Statistical Modelling & Computing 3 by Petra Kuhnert and Bill Venables:
- Extensive non-technical coverage of R, 364 pages
- An introduction to R 4 by The R core team: http://cran.r-project.org/doc/manuals/R-intro.pdf
- Reference introductory text for using R.
- Commented literature list: http://gbi.agrsci.dk/biomet/public_html/statmaster/course_information/literature.pdf
- Getting Started in R by S.A.Bashir : http://www.luchsinger-mathematics.ch/Bashir.pdf#search=%22Getting%20Started%20R%22
Script Editors
The built-in editor lacks some desirable features. For example, under Windows, it does not show matching parentheses. You will probably want to get a separate editor.Recently released RStudio, which is free, provides an integrated environment including a script editor that will probably displace previously available editors.
RStudio has probably superseded previous R editors but for historical completeness one can metion a number of other possibilities, some of which are free. Emacs is very powerful but difficult to learn, Tinn-R (see below) under Windows is easier to install and use but suffers from less than perfect reliability. WinEdt is not expensive (Academic: US$40) and is considered a very good editor with an interface, R-WinEdt designed for R.
Keeping your work
Probably, the ideal way (as of the fall of 2013) to keep output and to perform analyses in a way that is reproducible is to use R Markdown in RStudio.A more primitive but simple way to keep output and selected graphs so they can eventually become part of a report is to copy and paste output and graphs into a Word file. Graphs can be copied and pasted as 'Windows metafiles' without loss of resolution. Text in the R output window should be pasted with a 'fixed width font' such as Courier New.
Using and installing packages
Many packages come with R. To use them in an R session, you need to load the package. For example to load the MASS package which contains functions and datasets that accompany Venables and Ripley, Modern Applied Statistics with S, you use the command:> library(MASS)To get an overview of what's available in MASS, you use:
> library(help=MASS)
Installing additional packages
Some packages are not automatically installed when you install R but they need to be downloaded and installed individually. An important example is the 'car' package that accompanies Fox, Applied Regression. You install it with the R command:> install.packages("car")After installing it you load it the same way as a pre-installed package, i.e.
> library(car)To get information about the package, use:
> library(help = car)On your own computer, the package needs to be installed only once. On a lab computer you may need to reinstall in each new session.
At this stage, have a look at R basics on the UCLA ATS web site.
Setting up project directories
RStudio provides facilities for managing project directories. If you are working only with R you can organize your work in project directories as follows:- Create a directory for your project.
- Copy a workspace (a .Rdata file) to the directory
- You can then start R by clicking on the .Rdata file's icon
- All directory references in the R session will be relative to the project directory. For example, you can read a file 'data.csv' in the directory with
> data <- read.csv('data.csv')
R lessons
Template:IncompleteGenerate links to a set of lessons people can use to learn R. Each lesson should take approximately 1 hour and contain exercises.
R Tip sheets
Exploring more deeply
- Wikibook: R Programming
- Try R FAQ
- An advanced introdution[2]
- A good tutorial with lots on graphics etc.[3]
- http://www.nettakeaway.com/tp/?s=R
- A wiki for R tipe
- R for SAS and SPSS Users
Exploring much more deeply
This is not up to date. Please help- R Portal at UCLA[4]
- On-line book: Using R for Data Analysis and Graphics: Introduction, Code and Commentary by J H Maindonald updated: 14 November 2004 with on-line resources.
Courses in specialized areas
- Graphics in R: http://csg.sph.umich.edu/docs/R/graphics-1.pdf
Later
IncompleteIntroductions to R
- An Intruction to R|[html version
- Statistics with R
- Rtips Very extensive collection of tips gleaned from the R mailing list
- Applied Statistics With R by John Fox at Wien, May/June 2006
Materials from John Fox
Materials from John Fox- Learning R
- An Introduction to Statistical Computing in R (February 2005, California Center for Population Research, UCLA)
- An R and S-PLUS Companion to Applied Regression John Fox (especially see Scripts for examples by chapter and appendix , Web appendix to the text)
- Software Add Ons
- Rcmdr package for R (a basic-statistics graphical-user-interface for R).
- car (Companion to Applied Regression) package for R and library for S-PLUS. Software associated with An R and S-PLUS Companion to Applied Regression.
- effects (R package for effect displays).
Use stuff from here: Getting Started page on the old math wiki
- UCLA page on Installing, Customizing, and Updating R
- A wiki page on getting started with R
- UCLA page on learning R