This is a very simple Introduction to R to allow users to become used to working with data in R. R is available for Windows, Linux and MacOS from http://www.r-project.org

We also recommend use of a text editor that knows about R code - such as Tinn-R: http://www.sciviews.org/Tinn-R/. The code below is executable and can be pasted directly into R. Lines and text that begin with # are comments that will be ignored by R. Lines that are red are code and will be interpreted.

# variables - storing information # simple calculations of a variable # vectors # what does c() mean? # lets assign the vector 1,2,3,4 to variable v # simple calculations on a vector # acessing parts of vectors # useful functions to apply to vectors # generating sequences of numbers seq(1,10, by=1) x <- 1:10 # logical vectors # matrices x[1,2] # get element in first row, second column t(x) # transpose the matrix y <- array(20:40, dim=c(4,5)) cbind(x,y) # combine by columns # lists - like a named vector lst[[1]] # get the first element in the list # data frames - useful matrices :) is.data.frame(mirrors) # check and see if mirrors is a data frame mirrors[1:5, 1:3] # mirrors can be accessed in the same way as a matrix colnames(mirrors) # column names mirrors$Host # columns can be accessed like a list # we can also access them using the [..,..] notation and names, instead of numbers # save data |