# Contents

The material in this course requires R version 3.3 and Bioconductor version 3.4

stopifnot(
getRversion() >= '3.3' && getRversion() < '3.4',
BiocInstaller::biocVersion() == "3.4"
)

Version: 0.0.3
Compiled: Wed Jun 22 21:21:00 2016

# 1R

Language and environment for statistical computing and graphics

• Full-featured programming language
• Interactive and interpretted – convenient and forgiving
• Coherent, extensive documentation
• Statistical, e.g. factor(), NA
• Extensible – CRAN, Bioconductor, github, …

## 1.1 Vectors, classes, objects

• Efficient vectorized calculations on ‘atomic’ vectors logical, integer, numeric, complex, character, byte
• Atomic vectors are building blocks for more complicated objects
• matrix – atomic vector with ‘dim’ attribute
• data.frame – list of equal length atomic vectors
• Formal classes represent complicated combinations of vectors, e.g., the return value of lm(), below

## 1.2 Functions, generics, methods

• Functions transform inputs to outputs, perhaps with side effects, e.g., rnorm(1000)
• Argument matching first by name, then by position
• Functions may define (some) arguments to have default values
• Generic functions dispatch to specific methods based on class of argument(s), e.g., print().
• Methods are functions that implement specific generics, e.g., print.factor; methods are invoked indirectly, via the generic.

## 1.3 Introspection

• General properties, e.g., class(), str()
• Class-specific properties, e.g., dim()

## 1.4 Help

• ?print: help on the generic print
• ?print.data.frame: help on print method for objects of class data.frame.

Example

x <- rnorm(1000)                   # atomic vectors
y <- x + rnorm(1000, sd=.5)
df <- data.frame(x=x, y=y)         # object of class 'data.frame'
plot(y ~ x, df)                    # generic plot, method plot.formula

fit <- lm(y ~x, df)                # object of class 'lm'
methods(class=class(fit))          # introspection
##  [1] add1           alias          anova          case.names     coerce         confint
##  [7] cooks.distance deviance       dfbeta         dfbetas        drop1          dummy.coef
## [13] effects        extractAIC     family         formula        fortify        hatvalues
## [19] influence      initialize     kappa          labels         logLik         model.frame
## [25] model.matrix   nobs           plot           predict        print          proj
## [31] qr             residuals      rstandard      rstudent       show           simulate
## [37] slotsFromS3    summary        variable.names vcov
## see '?methods' for accessing help and source code

# 2 Resources

Acknowledgements

The research reported in this presentation was supported by the National Cancer Institute and the National Human Genome Research Institute of the National Institutes of Health under Award numbers U24CA180996 and U41HG004059, and the National Science Foundation under Award number 1247813. The content is solely the responsibility of the authors and does not necessarily represent the official views of the National Institutes of Health or the National Science Foundation.

## 2.1sessionInfo()

sessionInfo()
## R version 3.3.0 (2016-05-03)
## Platform: x86_64-pc-linux-gnu (64-bit)
## Running under: Ubuntu 14.04.4 LTS
##
## locale:
##  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8
##  [4] LC_COLLATE=C               LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
## [10] LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
##
## attached base packages:
##  [1] grid      stats4    parallel  stats     graphics  grDevices utils     datasets  methods
## [10] base
##
## other attached packages:
##  [1] airway_0.107.2                          BioC2016Introduction_0.0.3
##  [3] Homo.sapiens_1.3.1                      GO.db_3.3.0
##  [5] OrganismDbi_1.15.1                      AnnotationHub_2.5.4
##  [7] Gviz_1.17.4                             biomaRt_2.29.2
##  [9] org.Hs.eg.db_3.3.0                      BiocParallel_1.7.4
## [11] TxDb.Hsapiens.UCSC.hg19.knownGene_3.2.2 GenomicFeatures_1.25.14
## [13] AnnotationDbi_1.35.3                    VariantAnnotation_1.19.2
## [15] RNAseqData.HNRNPC.bam.chr14_0.11.0      GenomicAlignments_1.9.4
## [17] Rsamtools_1.25.0                        SummarizedExperiment_1.3.5
## [19] Biobase_2.33.0                          BSgenome.Hsapiens.UCSC.hg19_1.4.0
## [21] BSgenome_1.41.2                         rtracklayer_1.33.7
## [23] GenomicRanges_1.25.8                    GenomeInfoDb_1.9.1
## [25] Biostrings_2.41.4                       XVector_0.13.2
## [27] IRanges_2.7.11                          S4Vectors_0.11.7
## [29] BiocGenerics_0.19.1                     ggplot2_2.1.0
## [31] BiocStyle_2.1.10
##
## loaded via a namespace (and not attached):
##  [1] httr_1.2.0                    splines_3.3.0                 Formula_1.2-1
##  [4] shiny_0.13.2                  interactiveDisplayBase_1.11.3 latticeExtra_0.6-28
##  [7] RBGL_1.49.1                   yaml_2.1.13                   RSQLite_1.0.0
## [10] lattice_0.20-33               biovizBase_1.21.0             chron_2.3-47
## [13] digest_0.6.9                  RColorBrewer_1.1-2            colorspace_1.2-6
## [16] htmltools_0.3.5               httpuv_1.3.3                  Matrix_1.2-6
## [19] plyr_1.8.4                    XML_3.98-1.4                  zlibbioc_1.19.0
## [22] xtable_1.8-2                  scales_0.4.0                  nnet_7.3-12
## [25] survival_2.39-4               magrittr_1.5                  mime_0.4
## [28] evaluate_0.9                  foreign_0.8-66                graph_1.51.0
## [31] BiocInstaller_1.23.4          tools_3.3.0                   data.table_1.9.6
## [34] formatR_1.4                   matrixStats_0.50.2            stringr_1.0.0
## [37] munsell_0.4.3                 cluster_2.0.4                 ensembldb_1.5.8
## [40] RCurl_1.95-4.8                dichromat_2.0-0               bitops_1.0-6
## [43] labeling_0.3                  rmarkdown_0.9.6               gtable_0.2.0
## [46] codetools_0.2-14              DBI_0.4-1                     reshape2_1.4.1
## [49] R6_2.1.2                      gridExtra_2.2.1               knitr_1.13
## [52] Hmisc_3.17-4                  stringi_1.1.1                 Rcpp_0.12.5
## [55] rpart_4.1-10                  acepack_1.3-3.3