Skip to content
Snippets Groups Projects
Commit 014563f8 authored by Greg Wilson's avatar Greg Wilson Committed by GitHub
Browse files

Merge pull request #31 from fmichonneau/rmarkdown-example

add episode example written in Rmarkdown
parents 93764fa9 30368a61
Branches
Tags
No related merge requests found
---
title: "Demonstration of a lesson written using RMarkdown"
teaching: 10
exercises: 2
questions:
- "How to write a lesson using RMarkdown?"
objectives:
- "Explain how to use RMarkdown with the new lesson template."
- "Demonstrate how to include pieces of code, figures, and challenges."
keypoints:
- "It shouldn't be difficult"
---
This episode demonstrates all the features that can be used when writing a
lesson in RMarkdown.
This first chunk is really important, and should be included in all markdown lessons.
```{r, echo=FALSE}
source("../bin/chunk-options.R")
```
The rest of the lesson should be written as a normal RMarkdown file. You can
include chunk for codes, just like you'd normally do:
Normal output:
```{r}
1 + 1
```
Output with error message:
```{r}
x[10]
```
Output generating figures:
```{r plot-example}
library(ggplot2)
ggplot(diamonds, aes(x = carat, y = price, color = cut)) +
geom_point()
```
For the challenges and their solutions, you need to pay attention to the where
the `>` go and where to leave blank lines. Otherwise, you can include chunks in
it to include instructions and solutions.
> ## Challenge: Can you do it?
>
> What is the output of this command?
>
> ```{r, eval=FALSE}
> paste("This", "new", "template", "looks", "good")
> ```
>
> > ## Solution
> >
> > ```{r, echo=FALSE}
> > paste("This", "new", "template", "looks", "good")
> > ```
> {: .solution}
{: .challenge}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment