2. Essentials of the R Language

  1. Michael J. Crawley

Published Online: 14 SEP 2007

DOI: 10.1002/9780470515075.ch2

The R Book

The R Book

How to Cite

Crawley, M. J. (2007) Essentials of the R Language, in The R Book, John Wiley & Sons, Ltd, Chichester, UK. doi: 10.1002/9780470515075.ch2

Author Information

  1. Imperial College London at Silwood Park, UK

Publication History

  1. Published Online: 14 SEP 2007
  2. Published Print: 20 APR 2007

ISBN Information

Print ISBN: 9780470510247

Online ISBN: 9780470515075

SEARCH

Keywords:

  • essentials of R language;
  • built-in functions;
  • modulo and integer quotients;
  • sorts of rounding;
  • creating vector;
  • vector functions;
  • parallel minimum function;
  • computing arithmetic means;
  • loop avoidance

Summary

This chapter contains sections titled:

  • Screen prompt

  • Built-in Functions

  • Numbers with Exponents

  • Modulo and Integer Quotients

  • Rounding

  • Infinity and Things that Are Not a Number (NaN)

  • Missing values NA

  • Assignment

  • Operators

  • Creating a Vector

  • Named Elements within Vectors

  • Vector Functions

  • Summary Information from Vectors by Groups

  • Using with rather than attach

  • Using attach in This Book

  • Parallel Minima and Maxima: pmin and pmax

  • Subscripts and Indices

  • Working with Vectors and Logical Subscripts

  • Addresses within Vectors

  • Finding Closest Values

  • Trimming Vectors Using Negative Subscripts

  • Logical Arithmetic

  • Evaluation of combinations of TRUE and FALSE

  • Repeats

  • Generate Factor Levels

  • Generating Regular Sequences of Numbers

  • Variable Names

  • Sorting, Ranking and Ordering

  • The sample Function

  • Matrices

  • Arrays

  • Character Strings

  • The match Function

  • Writing functions in R

  • Variance

  • Degrees of freedom

  • Variance Ratio Test

  • Using Variance

  • Error Bars

  • Loops and Repeats

  • The switch Function

  • The Evaluation Environment of a Function

  • Scope

  • Optional Arguments

  • Variable Numbers of Arguments (…)

  • Returning Values from a Function

  • Anonymous Functions

  • Flexible Handling of Arguments to Functions

  • Evaluating Functions with apply, sapply and lapply

  • Looking for runs of numbers within vectors

  • Saving Data Produced within R to Disc

  • Pasting into an Excel Spreadsheet

  • Writing an Excel Readable File from R

  • Testing for Equality

  • Sets: union, intersect and setdiff

  • Pattern Matching

  • Testing and Coercing in R

  • Dates and Times in R