Professional Documents
Culture Documents
R Cheat Sheet: 1. Basics 4. Input and Export of Data
R Cheat Sheet: 1. Basics 4. Input and Export of Data
R cheat sheet Modified from: P. Dalgaard (2002). Introductory Statistics with R. Springer, New York.
1 2
BIO360 Biometrics I, Fall 2007 H. Wagner, Biology UTM
Arguments to breaks = c() Cutpoints. Note values of x outside of Discrete response binom.test Binomial test (incl. sign test)
cut() ‘breaks’ gives NA. Can also be a single prop.test Comparison of proportions
number, the number of cutpoints. fisher.test Exact test in 2 x 2 tables
labels = c() Names for groups. Default is 1, 2, ... chisq.test Chi-square test of independence
glm(y ~ x1+x2, Logistic regression
Factor recoding levels(f) <- names New level names binomial)
factor(newcodes[f]) Combining levels: ‘newcodes’, e.g.,
c(1,1,1,2,3) to amalgamate the first 3
of 5 groups of factor f
5 6
BIO360 Biometrics I, Fall 2007 H. Wagner, Biology UTM
6
PCA or redundancy analysis RDA. 1 black
Package ‘vegan’. 2 red
5
cca() Perform (canonical) correspondence 3 green
analysis, CA /CCA. Package: ‘vegan’
4
4 blue
diversity() Calculate diversity indices. Pkg: ‘vegan’ 5 light blue
3
6 purple
7 yellow
2
8 grey
1
7 8