Instructions on enabling Bioconductor style in your R markdown vignettes.
In order to build .Rmd documents the rmarkdown package is necessary, which relies on pandoc to compile the final output document. If you are working within a recent version of RStudio then both rmarkdown and pandoc should be already installed.
If you are missing the rmarkdown package then you can install it from CRAN using
install.packages("rmarkdown")
In this case a recent version of pandoc (>= 1.12.3) is also required. See the pandoc installation instructions for details on installing pandoc for your platform.
BiocStyle introduces the following macros useful when referring to R packages:
`r Biocpkg("IRanges")`
for Bioconductor software, annotation and experiment data packages, including a link to the release landing page or if the package is only in devel, to the devel landing page, IRanges.
`r CRANpkg("data.table")`
for R packages available on CRAN, including a link to the FHCRC CRAN mirror landing page, data.table.
`r Githubpkg("rstudio/rmarkdown")`
for R packages available on GitHub, including a link to the package repository, rmarkdown.
`r Rpackage("MyPkg")`
for R packages that are not available on Bioconductor, CRAN or GitHub; MyPkg.
Compared to the default markdown appearance the formatting differences include:
Images and tables appear centered, e.g.
v = seq(0, 60i, length = 1000)
plot(abs(v)*exp(v), type = "l", col = "Royalblue")
Tables are displayed with striped rows:
Fruit | Price
------- | -----
bananas | 1.2
apples | 1.0
oranges | 2.5
produces
Fruit | Price |
---|---|
bananas | 1.2 |
apples | 1.0 |
oranges | 2.5 |
Paragraph text is justified
External links open in new browser tab/window
Math symbols can be included in markdown documents. You can write math expressions the same way you would in Latex
, except some differences in escaping them.
Inline: For inline formulas use $P(x) = \frac{1}{2}$
or \(P(x) = \frac{1}{2}\)
, which both render as \(P(x) = \frac{1}{2}\).
Standalone: Math can be displayed in a separate line by writing $$P(x) = \frac{1}{2}$$
or \[P(x) = \frac{1}{2}.\]
, which both result in \[P(x) = \frac{1}{2}.\]
Here is the output of sessionInfo()
on the system on which this document was compiled:
## R version 3.3.1 (2016-06-21)
## 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
## [3] LC_TIME=en_US.UTF-8 LC_COLLATE=C
## [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
## [7] LC_PAPER=en_US.UTF-8 LC_NAME=C
## [9] LC_ADDRESS=C LC_TELEPHONE=C
## [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
##
## attached base packages:
## [1] stats graphics grDevices utils datasets methods base
##
## other attached packages:
## [1] BiocStyle_2.0.3
##
## loaded via a namespace (and not attached):
## [1] magrittr_1.5 formatR_1.4 htmltools_0.3.5 tools_3.3.1
## [5] yaml_2.1.13 Rcpp_0.12.6 stringi_1.1.1 rmarkdown_1.0
## [9] knitr_1.13 stringr_1.0.0 digest_0.6.10 evaluate_0.9