Use dataframe created in R codechunk in ojs codechunk in quarto

Viewed 117

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
}
1 Answers

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.

Related