Mark Dunning
Last modified: 29 Jul 2015
Sidney Harris - New York Times
Five selfish reasons - Florian Markowetz Blog and slides
rna-seq.R
knitr
package is being used convert the R script into ‘markdown’ format, which it then compiles into the output of your choosingknitr
is distributed with RStudio
knitr
is the modern-day equivalent of Sweave
rna-seq.Rmd
in your working directorylibrary(knitr)
spin(hair="rna-seq.R",knit=FALSE)
sessionInfo()
function
sessionInfo()
## R version 3.2.1 (2015-06-18)
## Platform: x86_64-pc-linux-gnu (64-bit)
## Running under: Ubuntu 14.04.2 LTS
##
## locale:
## [1] LC_CTYPE=en_GB.UTF-8 LC_NUMERIC=C
## [3] LC_TIME=en_GB.UTF-8 LC_COLLATE=en_GB.UTF-8
## [5] LC_MONETARY=en_GB.UTF-8 LC_MESSAGES=en_GB.UTF-8
## [7] LC_PAPER=en_GB.UTF-8 LC_NAME=C
## [9] LC_ADDRESS=C LC_TELEPHONE=C
## [11] LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C
##
## attached base packages:
## [1] stats graphics grDevices utils datasets methods base
##
## loaded via a namespace (and not attached):
## [1] magrittr_1.5 formatR_1.2 tools_3.2.1 htmltools_0.2.6
## [5] yaml_2.1.13 stringi_0.5-5 rmarkdown_0.7 knitr_1.10.5
## [9] stringr_1.0.0 digest_0.6.8 evaluate_0.7
File - > New File - > R Markdown
---
title: "Untitled"
author: "Mark Dunning"
date: "16/06/2015"
output: html_document
---
See Markdown Quick Reference in RStudio
code
To be or not to be
eval=FALSE
echo=FALSE
warning=FALSE
'''{r,eval=FALSE}
data <- read.delim("path.to.my.file")
'''
your P.I. wants to see your results, but doesn’t really want to know about the R code that you used
'''{r echo=FALSE}
load("mydata.rda")
'''
for(i in 1:100){
print(i)
}
not always helpful in a report
'''{r}
library(DESeq)
'''
## Loading required package: BiocGenerics
## Loading required package: parallel
##
## Attaching package: 'BiocGenerics'
##
## The following objects are masked from 'package:parallel':
##
## clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
## clusterExport, clusterMap, parApply, parCapply, parLapply,
## parLapplyLB, parRapply, parSapply, parSapplyLB
##
## The following object is masked from 'package:stats':
##
## xtabs
##
## The following objects are masked from 'package:base':
##
## anyDuplicated, append, as.data.frame, as.vector, cbind,
## colnames, do.call, duplicated, eval, evalq, Filter, Find, get,
## intersect, is.unsorted, lapply, Map, mapply, match, mget,
## order, paste, pmax, pmax.int, pmin, pmin.int, Position, rank,
## rbind, Reduce, rep.int, rownames, sapply, setdiff, sort,
## table, tapply, union, unique, unlist, unsplit
##
## Loading required package: Biobase
## Welcome to Bioconductor
##
## Vignettes contain introductory material; view with
## 'browseVignettes()'. To cite Bioconductor, see
## 'citation("Biobase")', and for packages 'citation("pkgname")'.
##
## Loading required package: locfit
## locfit 1.5-9.1 2013-03-22
## Loading required package: lattice
## Creating a generic function for 'nchar' from package 'base' in package 'S4Vectors'
## Welcome to 'DESeq'. For improved performance, usability and
## functionality, please consider migrating to 'DESeq2'.
Using message=FALSE
and warning=FALSE
'''{r message=FALSE,warning=FALSE}
library(DESeq)
'''
Could also need suppressPackageStartupMessages
cache=TRUE
will stop certain chunks from being evaluate if their code does not changewe don’t want to reload our dataset if we’ve only made a tiny change downstream
'''{r echo=FALSE,cache=TRUE}
load("mydata.rda")
'''
Use a plotting function (plot
, boxplot
, hist
etc) will include the plot at the relevant point in the document
'''{r}
plot(1:10, jitter(1:10))
'''
'''{r fig.height=2,fig.align='right', fig.height=4,fig.width=9}
plot(1:10, jitter(1:10))
'''
.....the sample population consisted of 'r table(gender)[1]' females and 'r table(gender)[2]' males.....
…..the sample population consisted of 47 females and 50 males…..
.....the p-value of the t-test is 'r pval', which indicates that.....
…..the p-value of the t-test is 0.05, which indicates that…..
.....the sample population consisted of 'r table(gender)[1]' females and 'r table(gender)[2]' males.....
…..the sample population consisted of 41 females and 54 males…..
.....the p-value of the t-test is 'r pval', which indicates that.....
…..the p-value of the t-test is 0.1, which indicates that…..
pval <- 0.1
.....The statistical test was 'r ifelse(pval < 0.05, "", "not")' significant....
The statistical test was not significant
pval <- 0.01
.....The statistical test was 'r ifelse(pval < 0.05, "", "not")' significant....
The statistical test was significant
The months of the year are 'r month.name'
The months of the year are January, February, March, April, May, June, July, August, September, October, November, December
pasilla-template.Rmd
in the Day4/rep-research/ folderpasilla-analysis.pdf