Hi,
I am trying to include Observable chunks in my Quarto document.
I am following the RStudio Quarto Observable book and some other questions in this forum, but I encountered a weird behaviour.
For a reprex, this is the document I am trying to render. You need the palmerpenguins
package to reproduce.
```{r}
ojs_define(data = palmerpenguins::penguins)
```
```{ojs}
viewof bill_length_min = Inputs.range(
[32, 50],
{value: 35, step: 1, label: "Bill length (min):"}
)
viewof islands = Inputs.checkbox(
["Torgersen", "Biscoe", "Dream"],
{ value: ["Torgersen", "Biscoe"],
label: "Islands:"
}
)
```
```{ojs}
filtered = transpose(data).filter(function(penguin) {
return bill_length_min < penguin.bill_length_mm &&
islands.includes(penguin.island);
})
```
```{ojs}
Plot.rectY(filtered,
Plot.binX(
{y: "count"},
{x: "body_mass_g", fill: "species", thresholds: 20}
))
.plot({
facet: {
data: filtered,
x: "sex",
y: "species",
marginRight: 80
},
marks: [
Plot.frame(),
]
}
)
```
Now, if I run quarto render penguins.qmd
in the terminal, the document renders without any interactive snippets (it just shows code chunks). If instead I run quarto preview penguins.qmd
it displays as expected.
Other information:
I am running RStudio 2022.07.0+548 "Spotted Wakerobin" Release (34ea3031, 2022-07-06) for macOS, on a M1 Max MacbookPro running macOS Monterey v12.5.1.
Any help or pointer to resources would be greatly appreciated!