R for Bioinformatics

Lesson 14 of 14 · 9 min

Where to Go Next

Congratulations on reaching the final lesson of R for Bioinformatics. You have gone from opening R for the very first time to writing real analysis code. This lesson looks back at what you learned and points you toward sensible next steps so you keep building momentum.

Along the way you stored values in variables, worked with vectors and data frames, filtered and summarised tables with the dplyr package, drew figures with the ggplot2 package, read data files from disk, and handled DNA and protein sequences with the Biostrings package. A variable is a named box that holds a value, a vector is an ordered list of values of the same kind, and a data frame is a table with rows and columns. Those pieces are the core building blocks of almost every bioinformatics workflow.

Reproducible Reports

A reproducible report is a single document that mixes your written explanation, your R code, and the results the code produces, so anyone can rerun it and get exactly the same output. Two tools make this easy. R Markdown files end in .Rmd and the newer Quarto files end in .qmd; both weave text and code together into a finished HTML web page, a PDF, or a Word document.

r
# install.packages() downloads a package once from CRAN, the official R archive
install.packages("rmarkdown")

# library() loads an installed package so its functions become available
library(rmarkdown)

# render() turns a report file into a finished document; here an HTML web page
render("analysis.Rmd")
processing file: analysis.Rmd
  |========================================| 100%
output file: analysis.knit.md

Output created: analysis.html

Getting Unstuck

r
# A question mark in front of a name opens that function's built-in help page
?mean

# help() does the same thing, written as an ordinary function call
help("read.csv")

# A vignette is a hands-on tutorial that ships inside a package;
# passing package = lists every vignette that Biostrings provides
vignette(package = "Biostrings")

# Pass a vignette's name to open its full walkthrough
vignette("BiostringsQuickOverview")

Tip: When code fails, read the error message first, then search the exact wording online. The Bioconductor support site at support.bioconductor.org, Stack Overflow, and the Posit Community forum at forum.posit.co are welcoming places to ask, and a package's own vignette often answers the question before you even need to post.

Where to Keep Learning

For general data skills, the free book R for Data Science by Wickham, Cetinkaya-Rundel, and Grolemund at r4ds.hadley.nz is the standard next step. For biology, the Bioconductor course materials at bioconductor.org/help/course-materials walk through complete analyses, such as RNA-seq differential expression using the rnaseqGene workflow. Practise on the datasets built into R, like iris and mtcars, or download real experiments from public repositories such as GEO and the TCGA cancer atlas. Our intermediate courses on RNA-seq analysis and statistics in R are the natural follow-on from here.

Try it yourself: In RStudio choose File, then New File, then R Markdown, keep all the defaults, and click the Knit button. You now have your very first reproducible report as an HTML page. Open it in your browser and read through it to see your text, code, and results in one document.