Skip to main content Accessibility help
×
Hostname: page-component-78c5997874-8bhkd Total loading time: 0 Render date: 2024-11-06T11:11:15.010Z Has data issue: false hasContentIssue false

3 - R

Published online by Cambridge University Press:  05 April 2015

Simon N. Wood
Affiliation:
University of Bath
Get access

Summary

Statistical analysis of interesting datasets is conducted using computers. Various specialised computer programmes are available to facilitate statistical work. For using general statistical theory directly with custom-built models, R is probably the most usefully flexible of such programmes.

R (R Core Team, 2012) is a progamming language and environment designed for statistical analysis. It is free (see http://cran.r-project.org to obtain a copy) and is written and maintained by a community of statisticians. A major design feature is extendibility. R makes it very straightforward to code up statistical methods in a way that is easy to distribute and for others to use. The first place to look for information on getting started with R is http://cran.r-project.org/manuals.html. I will assume that you have installed R, can start it to obtain a command console, and have at least discovered the function q() for quitting R.

The following web resources provide excellent guides to the R language at different levels.

  1. • http://cran.r-project.org/doc/contrib/Short-refcard.pdf is a four page summary of key functions and functionality.

  2. • http://cran.r-project.org/doc/contrib/R_language.pdf is a very concise introduction to and reference for the structure of the language.

  3. • http://cran.r-project.org/doc/manuals/R-lang.html is the main reference manual for the language.

A huge amount of statistical functionality is built into R and its extension packages, but the aim of this chapter is simply to give a brief overview of R as a statistical programming language.

Basic structure of R

When you start R (interactively) two important things are created: a command prompt at which to type commands telling R what to do, and an environment, known interchangeably as the ‘global environment’ or ‘user workspace’ to hold the objects created by your commands. Unlike the command prompt, you do not see the global environment directly, but it is there as an extendible chunk of computer memory for holding your data, commands and other objects.

Generically in R an ‘environment’ consists of two things. The first, known in R jargon as a frame, is a set of symbols used to refer to objects, along with the data defining those objects.

Type
Chapter
Information
Core Statistics , pp. 49 - 78
Publisher: Cambridge University Press
Print publication year: 2015

Access options

Get access to the full version of this content by using one of the access options below. (Log in options will check for institutional or personal access. Content may require purchase if you do not have access.)

Save book to Kindle

To save this book to your Kindle, first ensure [email protected] is added to your Approved Personal Document E-mail List under your Personal Document Settings on the Manage Your Content and Devices page of your Amazon account. Then enter the ‘name’ part of your Kindle email address below. Find out more about saving to your Kindle.

Note you can select to save to either the @free.kindle.com or @kindle.com variations. ‘@free.kindle.com’ emails are free but can only be saved to your device when it is connected to wi-fi. ‘@kindle.com’ emails can be delivered even when you are not connected to wi-fi, but note that service fees apply.

Find out more about the Kindle Personal Document Service.

  • R
  • Simon N. Wood, University of Bath
  • Book: Core Statistics
  • Online publication: 05 April 2015
  • Chapter DOI: https://doi.org/10.1017/CBO9781107741973.004
Available formats
×

Save book to Dropbox

To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Dropbox.

  • R
  • Simon N. Wood, University of Bath
  • Book: Core Statistics
  • Online publication: 05 April 2015
  • Chapter DOI: https://doi.org/10.1017/CBO9781107741973.004
Available formats
×

Save book to Google Drive

To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Google Drive.

  • R
  • Simon N. Wood, University of Bath
  • Book: Core Statistics
  • Online publication: 05 April 2015
  • Chapter DOI: https://doi.org/10.1017/CBO9781107741973.004
Available formats
×