vectors Using functions Getting help 2) Data and projects in R- Studio Creating an R project Organizing/cleaning data Importing/exporting Data 3) Pizza! 4) Intro to Plotting Reproducible plots Basic plotting Building complex plots by small steps 5) A la Carte (time permitting): Programming (loops, conditionals & functions) Intro to Simulation Q & A
is command-driven • R will not tell you what to do, nor guide you through the steps of an analysis or method. • R will do all the calculations for you, and it will do exactly what you tell it (not necessarily what you want). • R has the flexibility and power to do exactly what you want, exactly how you want it done.
R • images and other graphics made using R • a demonstration of linear modelling & GLMs • a list of available demos demo(graphics) demo(image) demo(lm.glm) demo() R is a show-off For even more demos, use: demo(package = .packages(all.available = TRUE))
assignment operator: <- assign the value on the right to the name on the left A <- 10 B <- 10*10 A_log <- log(A) B.seq <- 1:B Object names can be be (almost) anything you choose. They can include: Letters a-z, A-Z (case sensitive) Numbers 0-9 Periods . Underscores _ Should begin with a letter
object • To use a function (call), the command must be structured properly, following the "grammar rules" of the R language (syntax) log( 8 , base = 2 ) Function name No space Parentheses Argument 2 Arguments are separated by a Comma Argument 1
structure of the object names of items in the object attributes of the object summary statistics plot of all variable combinations data(CO2) head(CO2) str(CO2) names(CO2) attributes(CO2) summary(CO2) plot(CO2) Data Frames
CO2[sample(nrow(CO2), 10),] available named columns "Treatment" column all rows, column 3 row 3, all columns rows 1-6, all columns rows 1-6, column 3 elements 1-6 of Treatment rows where conc > 100 rows where Treatment == “chilled" 10 random rows
base functions in R, you can install additional packages to do specialized statistics and plotting. • Currently, the CRAN package repository features 4276 available packages. • http://cran.r-project.org/web/packages/