3

I'm completely new to using quarto. But one thing I wonder is if there is any chance to use a dataframe created "on the fly" in the quarto document in an observable (ojs) chunk, instead of maybe writing it out as CSV and reading it in? I guess there is no way at all, but you never know:)

So something like this:

df = data.frame(
  x = 1:10,
  y = 2:11
)
{
 // somehow get access to the df
}
Quinten
  • 35,235
  • 5
  • 20
  • 53
Lenn
  • 1,283
  • 7
  • 20
  • Do you want to use a dataframe for example in a next chunk without overwriting in the next chunk? – Quinten Jul 22 '22 at 15:46
  • 1
    My intention was more to create the data in R and wrangle in in JS (without writing it to disk) – Lenn Jul 23 '22 at 11:25

1 Answers1

1

Use the ojs_define() function to make data processed in Python or R available to {ojs} cells (this function should be called in the R or Python cell).

See more here in the Quarto Documentation.

Arthur Welle
  • 586
  • 5
  • 15