datacamp-light icon indicating copy to clipboard operation
datacamp-light copied to clipboard

An interactive learning widget for R using Quarto

Open prupk opened this issue 2 years ago • 0 comments

The following Test.Rmd will produce an interactive learning widget for [tag:R] using [tag:knitr] (see the link).

---
title: "Example Document"
author: "Your name here"
output:
  html_document:
    self_contained: false
---

```{r, include = FALSE}
tutorial::go_interactive()
```

By default, `tutorial` will convert all R chunks.

```{r}
a <- 2
b <- 3

a + b
```

Edited

Wondering how to an get an interactive learning widget for [tag:R] using [tag:quarto]. Need help for YAML of .qmd, my attempt is

    ---
title: "Test"
author: "MYaseen208"
format: 
  html:
    self_contained: false
---



```{r}
#| echo: false
#| include: false
tutorial::go_interactive()
```

```{r}
#| echo: false
1 + 1
```


You can add options to executable code like this 

```{r}
#| echo: false
2 * 2
```

The `echo: false` option disables the printing of code (only output is displayed).

However, it throws the following error:

ERROR: Validation of YAML front matter failed.
ERROR: (line 5, columns 3--7) Field "html" has empty value but it must instead be an object
4: format: 
5:   html:
        ~
6: ---

ERROR: Render failed due to invalid YAML.

Another attempt which render but don't produce the required output:

---
title: "Test1"
author: "MYaseen208"
format: 
  html:
    output-file: "Test1.html"
    self-contained: false
---

prupk avatar Feb 08 '23 15:02 prupk