Hello,

I tried to reproduce the quarto documentation ojs examples with the penguins dataset (I'm using VS Code). If I try to load the dataset from a csv file like in the example, it work but if I try to load the dataset with the R packages and to sent it to ojs with the ojs_define() function it doesn't.

To understand why, I tried to simply use ojs to show a table in the rendered document with the next code.

```{r}
library(palmerpenguins)
library(tidyverse)
ojs_define(data2 = as.matrix(penguins, dimnames(list(rownames(penguins),
colnames(penguins))), rownames.force = T))
```
```{ojs}
Inputs.table(data2)
```

I found 2 problems:
1. when I try to use the ojs_define function with a dataframe or a tibble, the ojs cell only give an error; "OJS Error TypeError: e is not iterable".
2. When I try to use the previous code (I convert the dataframe to a matrix), the table show by ojs doesn't keep the columns names.

![2022-05-24_164036](https://user-images.githubusercontent.com/86181677/170062991-f3205fa4-7a07-495b-b074-74d1d34df656.png)

May I ask you, if there is a solution to this problem. Also, would it be possible that you add on your website a list of the data format that can be sent to ojs and their correspondant javascript format (with more R examples please 🙏 ).

Thank you in advance.


cscheid
2022-05-24T14:44:44Z
Pierre9344
ojs-engine
closed
ojs_define doesn't work well with R dataframe and matrix
https://github.com/quarto-dev/quarto-cli/issues/962