Workshop notes

Setup

This workshop is designed to work with RStudio running in Posit Cloud. Go to https://posit.cloud/ and create a new project. Monash users can log in with their Monash Google account. The workshop can also be done using R locally on your laptop (if doing this, we also recommend you create a new project to contain the files).

Running the R code below will download files and install packages used in this workshop.

# Download data
download.file(
  "https://monashdatafluency.github.io/r-linear/r-linear-files.zip",
  destfile="r-linear-files.zip")
unzip("r-linear-files.zip")

# Install some CRAN packages:
install.packages(c(
    "tidyverse", "multcomp", "emmeans", 
    "lme4", "lmerTest", "pbkrtest", "BiocManager"))

# Install some Bioconductor packages:
BiocManager::install(c("limma","edgeR","topconfects"))

Now load the file linear_models.R in the r-linear-files folder.

Files

Key functions to remember

Built-in to R:

lm, model.matrix, coef, sigma, df.residual,
predict, confint, summary, anova, drop1, 
I, poly

splines – curve fitting:

ns, bs

multcomp and emmeans – linear hypothesis tests and multiple comparisons:

glht, mcp, confint, summary, emmeans

limma and edgeR – fitting many models to gene expression data:

DGEList, calcNormFactors, cpm,
lmFit, contrasts.fit, eBayes, plotSA, topTable

Author

This course has been developed for the Monash Bioinformatics Platform and Monash Data Fluency by Paul Harrison.

Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License.

Source code



Solutions to challenges