Ask yourself: Is conformity a good thing or a bad thing? Next
Idea Transcript
An introduction to R Longhow Lam Under Construction Feb-2010 some sections are unfinished!
longhowlam at gmail dot com
Contents 1 Introduction 1.1 What is R? . . . . . . . . . . . . . . . . . . . 1.2 The R environment . . . . . . . . . . . . . . . 1.3 Obtaining and installing R . . . . . . . . . . . 1.4 Your first R session . . . . . . . . . . . . . . . 1.5 The available help . . . . . . . . . . . . . . . . 1.5.1 The on line help . . . . . . . . . . . . . 1.5.2 The R mailing lists and the R Journal 1.6 The R workspace, managing objects . . . . . . 1.7 R Packages . . . . . . . . . . . . . . . . . . . 1.8 Conflicting objects . . . . . . . . . . . . . . . 1.9 Editors for R scripts . . . . . . . . . . . . . . 1.9.1 The editor in RGui . . . . . . . . . . . 1.9.2 Other editors . . . . . . . . . . . . . .
. . . . . . . . . . . . .
. . . . . . . . . . . . .
. . . . . . . . . . . . .
. . . . . . . . . . . . .
. . . . . . . . . . . . .
. . . . . . . . . . . . .
. . . . . . . . . . . . .
. . . . . . . . . . . . .
. . . . . . . . . . . . .
. . . . . . . . . . . . .
. . . . . . . . . . . . .
. . . . . . . . . . . . .
. . . . . . . . . . . . .
. . . . . . . . . . . . .
. . . . . . . . . . . . .
7 7 8 8 9 11 11 12 12 13 15 16 16 16
2 or the curve function. Different uses of the function plot . . . . . . . . . . . . . . . . . . . . . Example distribution plot in R . . . . . . . . . . . . . . . . . . . . . . . Example barplot where the first argument is a matrix . . . . . . . . . . . Example graphs of multi dimensional ) [1] "x" "x2"
If you assign a value to an object that already exists then the contents of the object will be overwritten with the new value (without a warning!). Use the function rm to remove one or more objects from your session. > rm(x, x2)
To conclude your first session, we create two small vectors with , header=TRUE) mydf Col1 Col2 Col3 Col4 1 23 45 A John 2 34 41 B Jimmy 3 12 99 B Patrick
By default R converts character , header=TRUE, stringsAsFactors=FALSE )
To specify that certain columns are character and other columns are not you must use the colClasses argument and provide the type for each column. mydf