22 July 2016
Tools > Install Packages...
Go to the Help Tab
Home > Packages > dplyr
Here you can see all of the functions in dplyr
Many packages also define objects of a given class,
e.g. a data_frame, tbl_df or tibble
browseVignettes()
Also has an active support community:
A recent training course:
http://www.bioconductor.org/help/course-materials/2016/BioC2016/
Some upcoming courses:
3 Broad Headings based on package tags, or biocViews
affy, gcrma, limmabiomaRt, topGOedgeR, DESeq, RSamtoolsmuscle, RBowtieOrgDb, TxDb, OrganismDb, BSgenome)source("http://bioconductor.org/biocLite.R")
BiocInstallerbiocLite()R dependencies can be challenging!
To check that you have the tested package versions and fix them
library(BiocInstaller) biocValid(fix = TRUE)
R has two common types of objects
S3 and S4S3 are very common
lm() or t.test()Each defined class has a set of methods associated with it
iris_lm <- lm(Petal.Length ~ Species, data = iris) class(iris_lm) typeof(iris_lm)
At it's heart an object of class lm is a list
lm objects depend on this structuremethods(class = "lm")
These are all functions that can be applied to an lm object
Let's pick one of those defined methods, e.g. residuals()
methods("residuals")
Note the suffixes!!
Functions that end in name.something() apply to objects of class something
class(iris_lm) <- "htest"
No error message!!!???
iris_lm
Did we break it?
str(iris_lm)
body(summary.lm) body(summary.default)
Many packages define methods for given objects
methods(class = "data.frame")
library(dplyr) methods(class = "data.frame")
body(print)
This doesn't seem to make sense
Now type a . after print, then Tab
These are all the visible classes a print method exists for
methods(print)
Many Bioconductor Packages define S4 objects
@ symbol as well as $Some packages use S4 implementations of S3 objects, e.g.
data.frame (S3) Vs DataFrame (S4)rle (S3) Vs RleLook and behave very similarly, but can trip you over
DataFrame and you give it a data.framedata.frame themedata.frame themedata.frame
rownamestbl_df aka data_frame
rownames are always 1:nrow(df)data.frame themelibrary(tibble)
mtcars
mtcars %>% rownames_to_column("model") %>% as_tibble()
mtcars %>% rownames_to_column("model") %>% as_tibble() %>% print(n=3)
I this last line we used print.tbl_df
data.frame theme DataFrame objectslibrary(S4Vectors) ?DataFrame
S4 versiontbl_df objects)CharacterList() from IRanges is useddplyr unless coerceddata.frame themelibrary(IRanges)
genes <- c("A", "B")
transcripts <- CharacterList(c("A1", "A2", "A3"),
c("B1", "B2"))
transcripts
DF <- DataFrame(Gene = genes, Transcripts = transcripts) DF
## DataFrame with 2 rows and 2 columns ## Gene Transcripts ## <character> <CharacterList> ## 1 A A1,A2,A3 ## 2 B B1,B2
data.frame theme AnnotatedDataFrame ObjectsEnables addition of metadata
library(Biobase)
metaData <- data.frame(labelDescription = c("The measured length",
"The Delivery Method",
"The Dose in mg"))
newTooth <- AnnotatedDataFrame(data = ToothGrowth,
varMetadata = metaData)
newTooth pData(newTooth) varMetadata(newTooth)