In 2016 I offered a 2-day version of the Transition to R class, covering just the basics to get people up and running in R. Here are the Documents from that class. ENJOY!
RBeginners_A simple analysis.PDF
IMPORTANT NOTE ON LINKS TO DATA. The website has moved since this course was last offered, so the URLs to datasets in the handouts are broken. Please note, however, that all the datasets are still available, below. You can download them, or get their current URLs by right-clicking on the links, and then modifying the links in the Rcode. I will be updating this soon, but in the meantime...
Syllabus, class notes, and class videos
Here are the detailed handouts, and in-class videos of the lectures and conversations from the 2015 version of ENVS291 Transition to R. Use at your own risk. All handout and video contents are the 2015 copyright of Gregory S. Gilbert, University of California, Santa Cruz
Fitting models; Extractor functions; linear regression using lm; ANOVA using aov or lm; ttest and rank tests; factorial, blocked, and split-plot designs; ANCOVA; Homogeneity of variance; Type I and III sums of squares; predict for fitted lines and confidence intervals; stepwise selection
Class10a Vegan Community Ecology Analysis.PDF no class video
Basics of Vegan package for analysis of community structure and diversity data. Measures of diversity; NMDS NOT UPDATED SINCE 2013; SOME PARTS ARE OUT OF DATE.
Class10b Picate and Phylomatic Phylogenetic Ecology tools.PDF no lecture video
Very brief introduction to tools for phylogenetic community ecology and trait analysis. NOT UPDATED SINCE 2013 SOME THINGS ARE OUT OF DATE! Newick tree format; making phylogenetic trees from phylomatic; phylogenetic diversity measures
These are the data used for all the scatterplot examples. Copy and paste these into the R console, and hit return. Then copy and paste the code from any of the graphs to reproduce the graphs.
plot(x,y1,xlab="arrival order",ylab="hat size (cm)", ylim=c(0,10),xlim=c(0,8))
#add smooth lowess curves to each set of points in the scatterplot
plot(x,y1,xlab="arrival order",ylab="hat size (cm)",ylim=c(0,10),xlim=c(0,8),col="dark green",pch=1,lwd=2)
plot(x,y1,xlab="arrival order",ylab="hat size (cm)",ylim=c(0,10),xlim=c(0,8),col="black",pch=1,lwd=1)
#get the relevant statistics for the regression line, then put on the graph as text
a<-summary(lm(y2~x)) #this puts summary stats of the linear regression of y2 on x into list a
R2<-signif(a$adj.r.squared,3) #adjusted R squared
F<-signif(a$fstatistic,3) #F statistic
ndf<-signif(a$fstatistic,1) #degrees of freedom numerator
ddf<- signif(a$fstatistic,1) #degress of freedom denominator
P<-signif(a$coefficients[2,4],4) #P value for significant slope
plot(x,y2,xlab="arrival order",ylab="hat size (cm)",ylim=c(0,10),xlim=c(0,8),col="blue",pch=19,lwd=1)
abline(lm(y2~x),lwd=1,lty=1,col="blue") #puts in the regression line
text(0,9,paste("F=",F,", df=",ndf,",",ddf,"n","R^2=",R2,", P=",P,sep=""),pos=4) #adds the statistics