Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unify lesson pipeline with Reticulate #202

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
131 changes: 0 additions & 131 deletions _episodes/05-rmarkdown-example.md

This file was deleted.

3 changes: 3 additions & 0 deletions _episodes/01-design.md → _episodes_rmd/01-design.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ objectives:
keypoints:
- "Lessons are design in four stages: conceptual, summative, formative, and connective."
---
```{r, echo=FALSE}
source("../bin/chunk-options.R")
```

This episode describes how we go about designing lessons and why.
For more information on how we design lessons and why,
Expand Down
3 changes: 3 additions & 0 deletions _episodes/02-tooling.md → _episodes_rmd/02-tooling.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ keypoints:
- "Each page's configuration is stored at the top of that page."
- "Groups of files are stored in collection directories whose names begin with an underscore."
---
```{r, echo=FALSE}
source("../bin/chunk-options.R")
```

This episode describes the tools we use to build and manage lessons.
These simplify many tasks, but make other things more complicated.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ keypoints:
- "The home page, reference guide, setup instructions, discussion page, and instructors' guide must be updated for each lesson."
- "The Makefile stores commonly-used commands."
---
```{r, echo=FALSE}
source("../bin/chunk-options.R")
```

Each lesson is made up of *episodes*, which are focused on a particular topic and
include time for both teaching and exercises.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ keypoints:
- "Special sections are formatted as blockquotes that open with a level-2 header and close with a class identifier."
- "Special sections may be callouts or challenges; other styles are used by the template itself."
---
```{r, echo=FALSE}
source("../bin/chunk-options.R")
```

A lesson consists of one or more episodes,
each of which has:
Expand Down
74 changes: 74 additions & 0 deletions _episodes_rmd/05-bash-example.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
---
source: Rmd
title: "Using Bash with RMarkdown"
teaching: 10
exercises: 2
questions:
- "How to call `bash` from RMarkdown?"
objectives:
- "Demonstrate how to include pieces of Bash code, figures, and challenges."
keypoints:
- "`bash` code blocks"
---
```{r, echo=FALSE}
source("../bin/chunk-options.R")
```

This episode demonstrates all the features that can be used
when using Bash from [RMarkdown][r-markdown].

You can include chunk for codes, just like you'd normally do.

Normal output:

```{bash}
pwd
```

Output with error message:

```{bash}
foo
```

For the challenges and their solutions, you need to pay attention to where the
`>` go and where to leave blank lines. You can include code chunks in both the
instructions and solutions. For instance

```
> ## Challenge: Can you do it?
>
> What is the output of this command?
>
> ```{bash, eval=FALSE}`r ''`
> ls data -a -F
> ```
>
> > ## Solution
> >
> > ```{bash, echo=FALSE}`r ''`
> > ls data -a -F
> > ```
> {: .solution}
{: .challenge}
```

will generate

> ## Challenge: Can you do it?
>
> What is the output of this command?
>
> ```{bash, eval=FALSE}
> ls data -a -F
> ```
>
> > ## Solution
> >
> > ```{bash, echo=FALSE}
> > ls data -a -F
> > ```
> {: .solution}
{: .challenge}

{% include links.md %}
83 changes: 83 additions & 0 deletions _episodes_rmd/06-python-example.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
---
source: Rmd
title: "Using Python with RMarkdown"
teaching: 10
exercises: 2
questions:
- "How to call `python` from RMarkdown?"
objectives:
- "Demonstrate how to include pieces of Python code, figures, and challenges."
keypoints:
- "`python` code blocks"
---
```{r, echo=FALSE}
source("../bin/chunk-options.R")
```

This episode demonstrates all the features that can be used
when using Python from [RMarkdown][r-markdown].

You can include chunk for codes, just like you'd normally do.

Normal output:

```{python}
1 + 1
```

Output with error message:

```{python}
x[10]
```

Output generating figures:

```{python python-plot-example}
import matplotlib.pyplot as plt

plt.plot([1, 2, 3, 4])
plt.show()
```

For the challenges and their solutions, you need to pay attention to where the
`>` go and where to leave blank lines. You can include code chunks in both the
instructions and solutions. For instance

```
> ## Challenge: Can you do it?
>
> What is the output of this command?
>
> ```{python, eval=FALSE}`r ''`
> print("This new template looks good!")
> ```
>
> > ## Solution
> >
> > ```{python, echo=FALSE}`r ''`
> > print("This new template looks good!")
> > ```
> {: .solution}
{: .challenge}
```

will generate

> ## Challenge: Can you do it?
>
> What is the output of this command?
>
> ```{python, eval=FALSE}
> print("This new template looks good!")
> ```
>
> > ## Solution
> >
> > ```{python, echo=FALSE}
> > print("This new template looks good!")
> > ```
> {: .solution}
{: .challenge}

{% include links.md %}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
source: Rmd
title: "Using RMarkdown"
title: "Using R with RMarkdown"
teaching: 10
exercises: 2
questions:
Expand Down Expand Up @@ -50,7 +50,7 @@ x[10]

Output generating figures:

```{r plot-example}
```{r r-plot-example}
library(ggplot2)
ggplot(diamonds, aes(x = carat, y = price, color = cut)) +
geom_point()
Expand All @@ -65,13 +65,13 @@ instructions and solutions. For instance this:
>
> What is the output of this command?
>
> ```{r, eval=FALSE}
> ```{r, eval=FALSE}`r ''`
> paste("This", "new", "template", "looks", "good")
> ```
>
> > ## Solution
> >
> > ```{r, echo=FALSE}
> > ```{r, echo=FALSE}`r ''`
> > paste("This", "new", "template", "looks", "good")
> > ```
> {: .solution}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ objectives:
keypoints:
- "Keyboard keys need to use `<kbd>` HTML tag."
---
```{r, echo=FALSE}
source("../bin/chunk-options.R")
```

## Keyboard Key

Expand Down
3 changes: 3 additions & 0 deletions _episodes/07-checking.md → _episodes_rmd/09-checking.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ keypoints:
- "The checker uses the same Markdown parser as Jekyll."
- "Lessons can be previewed by running `make serve`."
---
```{r, echo=FALSE}
source("../bin/chunk-options.R")
```

The lesson template comes with several utilities to simplify lesson development and maintenance.

Expand Down
3 changes: 3 additions & 0 deletions _episodes/08-coffee.md → _episodes_rmd/10-coffee.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ layout: break
title: "Coffee Break"
break: 15
---
```{r, echo=FALSE}
source("../bin/chunk-options.R")
```

Use the `break` layout for placeholder episodes representing coffee breaks and lunches.
These episodes do *not* have exercises, questions, objectives, or keypoints in their metadata,
Expand Down
Loading