Home

Awesome

<!-- README.md is generated from README.Rmd. Please edit that file -->

asis_chunk

Insert code chunk calling asis engine into R Markdown documents. An RStudio addin.

Inserts:

By Enrico Manlapig

Main functions:

Installation

Development version:

install.packages(“devtools”)

devtools::install_github(“EnricoManlapig/asischunk”)

Use

The asis engine allows users to write markdown within chunks. These chunks can then be conditionally rendered using parameters defined in the YAML or elsewhere in the document.

Example

By assigning the addin a keyboard shortcut, the addin gives the user a shortcut to the asis engine. The asis function is useful when the author intends to create different texts from the same document. For example, a teacher may want to render a version with a prompt for students and another version with solutions.

```{r toggle_solutions}
solutions <- TRUE
```

What is half of $4x$?

```{asis student_prompt, include = !solutions}
Write your answer here: 
```

```{asis instructor_solutions, include = solutions}
Correct answer: $\frac{4x}{2}= 2x$
```

If the object solutions takes the value FALSE, then the first chunk, student_prompt, is rendered. If solutions takes the value TRUE, then the second chunk, instructor_solutions, is rendered.