R Function Cheat Sheet
R Function Cheat Sheet
Once you have installed R and R Studio you will need to install BioConductor packages using the
biocLite.R installation script.
This installs the following packages: affy, affydata, affyPLM, annaffy, annotate, Biobase, Biostrings, DynDoc,
gcrma, genefilter, geneplotter, hgu95av2.db, limma, marray, matchprobes, multtest, ROC, vsn, xtable,
affyQCReport. After downloading and installing these packages, the script prints "Installation complete" and
TRUE
Functions:
Determining the dimensions of the dataframe, returns size of the data frame by rows and columns
> dim(data)
> names(data)
ALS411
Biomedical Data Systems and Informatics
Seeing the structure of the data, very useful for accessing the information in the data
> str(data)
Seeing a breakdown (min, max, 1st quantile, distributsions ect… of the data
> summary(data)
Log2 transforming the data and create a new data matrix called “log2data”
> logdata<-log2(data)
> plot(logdata[,1],logdata[,2])
Pull out the 8 am data from the data matrix and put it in a new matrix called 8am
> amdata<-logdata[,1:8]
> pairs(amdata)
> write.table(log2data,"log2data.txt",sep="\t")
Use is.data to test for data type data. Returns TRUE or FALSE
is.numeric(), is.character(), is.vector(), is.matrix(), is.data.frame()as.numeric(),
> write.table(tablename,"tablename.txt",sep="\t")
Here is how to sort and check by just looking at the first or last five rows of data
head(logdata[order(row.names(logdata)),])
tail(logdata[order(row.names(logdata)),])