### R code from vignette source 'RBiocForEveryone.Rnw' ################################################### ### code chunk number 1: setup ################################################### library(Biostrings) ################################################### ### code chunk number 2: data-types ################################################### df <- data.frame( age = c(27, 32, 19), sex = factor(c("Male", "Female", NA))) df ################################################### ### code chunk number 3: functions ################################################### y <- 5:1 # vector: 5, 4, 3, 2, 1 log(y) # log of each element, 'vectorized' args(log) # discovery; argument 'base' has default log(base=2, y) # match by name, then position ################################################### ### code chunk number 4: classes-and-methods ################################################### x <- rnorm(1000, sd=1); y <- x + rnorm(1000, sd=.5) fit <- lm(y ~ x); class(fit) head(methods(class=class(fit)), 3) anova(fit) ################################################### ### code chunk number 5: S4 ################################################### library(Biostrings) dna <- DNAStringSet(c("AACA", "ATTA")) ## showMethods(class=class(dna), ## where=search()) alphabetFrequency(dna, baseOnly=TRUE) ################################################### ### code chunk number 6: biocLite (eval = FALSE) ################################################### ## source("http://bioconductor.org/biocLite.R") ## biocLite("ShortRead") # install 'ShortRead' package ## biocLite() # update all installed packages ## library(ShortRead) # attach to current session ################################################### ### code chunk number 7: help (eval = FALSE) ################################################### ## help.start() ## ?data.frame ## ?anova ## ?anova.lm # anova generic, method for class lm ## class ? DNAStringSet ## method ? "alphabetFrequency,DNAStringSet" ## vignette("GenomicRangesIntroduction", "GenomicRanges") ## help(package="Biostrings") ## RShowDoc("R-intro")