Skip to content

feat(exercise): Support exercise.pipe option#804

Merged
gadenbuie merged 3 commits intomainfrom
feat/native-pipe-shortcut
Sep 27, 2023
Merged

feat(exercise): Support exercise.pipe option#804
gadenbuie merged 3 commits intomainfrom
feat/native-pipe-shortcut

Conversation

@gadenbuie
Copy link
Member

Globally choose pipe characters, or set them per exercise. Default is chosen based on the current version of R in the rendering environment.

Supersedes #786


You can set the characters used for the pipe shortcut at the tutorial level with

knitr::opts_chunk$set(exercise.pipe = "%>%")

Or you can set the pipe option at the individual level using the exercise.pipe chunk option.

```{r base-pipe, exercise=TRUE, exercise.pipe="|>"}
mtcars count(cyl)
```

By default, if not set otherwise set, learnr will use the base R pipe (|>) when the tutorial is rendered in R >= 4.1.0.

Globally choose pipe characters, or set them per exercise. Default is chosen based on the current version of R in the rendering environment.
@gadenbuie gadenbuie merged commit 20e4cb6 into main Sep 27, 2023
@gadenbuie gadenbuie deleted the feat/native-pipe-shortcut branch September 27, 2023 20:00
@statik
Copy link

statik commented Sep 27, 2023

@gadenbuie thank you for this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants