Loading _episodes/06-rmarkdown-example.md +44 −16 Original line number Diff line number Diff line Loading @@ -10,15 +10,32 @@ objectives: 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. To generate the site, you will need to have the following packages installed: ```r install.packages(c("knitr", "stringr", "checkpoint")) ``` If the lesson uses additional packages, the script that converts the Rmd files into markdown, will detect them and install them for you, when you run `make serve` or `make site`. This first chunk is really important, and need to be included at the beginning of each episode written in RMarkdown. ~~~ source("../bin/chunk-options.R") ~~~ {: .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: include chunk for codes, just like you'd normally do. Normal output: Loading Loading @@ -55,19 +72,6 @@ Output generating figures: ~~~ library(ggplot2) ~~~ {: .r} ~~~ Warning: package 'ggplot2' was built under R version 3.1.3 ~~~ {: .error} ~~~ ggplot(diamonds, aes(x = carat, y = price, color = cut)) + geom_point() ~~~ Loading @@ -77,7 +81,31 @@ ggplot(diamonds, aes(x = carat, y = price, color = cut)) + 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. it to include instructions and solutions. For instance this: ``` > ## Challenge: Can you do it? > > What is the output of this command? > > > ~~~ > paste("This", "new", "template", "looks", "good") > ~~~ > {: .r} > > > ## Solution > > > > > > ~~~ > > [1] "This new template looks good" > > ~~~ > > {: .output} > {: .solution} {: .challenge} ``` will generate this: > ## Challenge: Can you do it? > Loading _episodes_rmd/06-rmarkdown-example.Rmd +36 −4 Original line number Diff line number Diff line Loading @@ -10,17 +10,29 @@ objectives: 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. To generate the site, you will need to have the following packages installed: ```{r, eval=FALSE} install.packages(c("knitr", "stringr", "checkpoint")) ``` If the lesson uses additional packages, the script that converts the Rmd files into markdown, will detect them and install them for you, when you run `make serve` or `make site`. This first chunk is really important, and need to be included at the beginning of each episode written in RMarkdown. ```{r, echo=FALSE} ```{r, echo=TRUE} 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: include chunk for codes, just like you'd normally do. Normal output: Loading @@ -44,7 +56,27 @@ ggplot(diamonds, aes(x = carat, y = price, color = cut)) + 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. it to include instructions and solutions. For instance this: ``` > ## 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} ``` will generate this: > ## Challenge: Can you do it? > Loading Loading
_episodes/06-rmarkdown-example.md +44 −16 Original line number Diff line number Diff line Loading @@ -10,15 +10,32 @@ objectives: 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. To generate the site, you will need to have the following packages installed: ```r install.packages(c("knitr", "stringr", "checkpoint")) ``` If the lesson uses additional packages, the script that converts the Rmd files into markdown, will detect them and install them for you, when you run `make serve` or `make site`. This first chunk is really important, and need to be included at the beginning of each episode written in RMarkdown. ~~~ source("../bin/chunk-options.R") ~~~ {: .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: include chunk for codes, just like you'd normally do. Normal output: Loading Loading @@ -55,19 +72,6 @@ Output generating figures: ~~~ library(ggplot2) ~~~ {: .r} ~~~ Warning: package 'ggplot2' was built under R version 3.1.3 ~~~ {: .error} ~~~ ggplot(diamonds, aes(x = carat, y = price, color = cut)) + geom_point() ~~~ Loading @@ -77,7 +81,31 @@ ggplot(diamonds, aes(x = carat, y = price, color = cut)) + 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. it to include instructions and solutions. For instance this: ``` > ## Challenge: Can you do it? > > What is the output of this command? > > > ~~~ > paste("This", "new", "template", "looks", "good") > ~~~ > {: .r} > > > ## Solution > > > > > > ~~~ > > [1] "This new template looks good" > > ~~~ > > {: .output} > {: .solution} {: .challenge} ``` will generate this: > ## Challenge: Can you do it? > Loading
_episodes_rmd/06-rmarkdown-example.Rmd +36 −4 Original line number Diff line number Diff line Loading @@ -10,17 +10,29 @@ objectives: 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. To generate the site, you will need to have the following packages installed: ```{r, eval=FALSE} install.packages(c("knitr", "stringr", "checkpoint")) ``` If the lesson uses additional packages, the script that converts the Rmd files into markdown, will detect them and install them for you, when you run `make serve` or `make site`. This first chunk is really important, and need to be included at the beginning of each episode written in RMarkdown. ```{r, echo=FALSE} ```{r, echo=TRUE} 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: include chunk for codes, just like you'd normally do. Normal output: Loading @@ -44,7 +56,27 @@ ggplot(diamonds, aes(x = carat, y = price, color = cut)) + 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. it to include instructions and solutions. For instance this: ``` > ## 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} ``` will generate this: > ## Challenge: Can you do it? > Loading