2016-01-20

Teaching Method per Module

Follow a schedule for the 3 hour class with the following elements per module:

  1. Lecture to introduce: watch presentation

  2. Demo to show: watch instructor use RStudio to get overall idea

  3. Exercise to learn: do it yourself, individually, with given material

  4. Group to apply: apply new technique to your group project (ie specific data and question)

Real Skills Learned

  • Technology changes rapidly

  • Yes, you're learning about tools and libraries specific to R, but the concepts are applicable to most any programming language

  • The real skill learned here is critical thinking / problem solving / googling to figure out how to get your science done!

Flipped Classroom

Rmarkdown

Inspiration

What is Rmarkdown?

Rmarkdown = R + markdown

  • input simple text:
    • markdown: simple formatting of text (bold, links, headers, images, …)
    • R: execute chunks of code (figures, tables…)
  • output various formats:
    • html: share on public website
    • pdf: polished publication
    • docx: share with co-authors to track changes

First Example of Rmarkdown

In RStudio, menu File > New File > Rmarkdown… Document, HTML. Knit HMTL button to render the right.

Markdown

"easy" HTML

Github renders (with flavor), eg README.md

R in Rmarkdown - Chunk

Surround code with 3 backticks with {r} in first line

R in Rmarkdown - Inline

Surround code in single backticks

pi=`r pi` evaluates to "pi=3.1415927"

Equations in Rmarkdown - Chunk

Uses Latex markup language for equations as input. Outputs using MathJax JavaScript library for HTML output, native for PDF.

$$
\frac{1}{n} \sum_{i=i}^{n} x_{i}
$$

\[ \frac{1}{n} \sum_{i=i}^{n} x_{i} \]

Equations in Rmarkdown - Inline

The Arithmetic mean is equal to $\frac{1}{n} \sum_{i=i}^{n} x_{i}$, or the summation of n numbers divided by n.

The Arithmetic mean is equal to \(\frac{1}{n} \sum_{i=i}^{n} x_{i}\), or the summation of n numbers divided by n.

Github Friendly

  • Rmarkdown (*.Rmd) renders as markdown (*.md)

  • easy to see change in simple text files (vs binary / proprietary formats)

Demo

Rstudio: menu File > New File > Rmarkdown… Document, HTML. Knit HMTL button.

Help

Further Resources