Display an Observable notebook as HTML widget
robservable(
notebook,
include = NULL,
hide = NULL,
input = NULL,
input_js = NULL,
observers = NULL,
update_height = TRUE,
update_width = TRUE,
width = NULL,
height = NULL,
elementId = NULL,
json_args = list(dataframe = "rows"),
json_func = NULL
)
The notebook id, such as "@d3/bar-chart", or the full notebook URL.
character vector of cell names to be rendered. If NULL, the whole notebook is rendered.
character vector of cell names in include
to be hidden in the output.
A named list of cells to be updated with a fixed value.
A named list of cells to be updated with JavaScript code. Each list element is itself a list
with a vector of argument names as inputs
entry, and a character string of JavaScript code
as definition
entry, as expected by Observable runtime variable.define function.
A vector of character strings representing variables in observable that you would like to set as input values in Shiny.
if TRUE (default) and input$height is not defined, replace its value with the height of the widget root HTML element. Note there will not always be such a cell in every notebook. Set it to FALSE to always keep the notebook value.
if TRUE (default) and input$width is not defined, replace its value with the width of the widget root HTML element. Set it to FALSE to always keep the notebook or the Observable stdlib value.
htmlwidget width.
htmlwidget height.
optional manual widget HTML id.
custom arguments passed to JSON serializer.
optional custom JSON serializer R function.
An object of class htmlwidget
.
If a data.frame is passed as a cell value in input
, it will be converted into the format
expected by d3
(ie, converted by rows).
For more details on the use of input_js
to update cells with JavaScript code, see the
introduction vignette and https://github.com/observablehq/runtime#variable_define.
## Display a notebook cell
robservable(
"@juba/robservable-bar-chart",
include = "chart"
)
## Change cells data with input
robservable(
"@juba/robservable-bar-chart",
include = "chart",
input = list(color = "red", height = 700)
)
## Change data frame cells data
df <- data.frame(table(mtcars$cyl))
names(df) <- c("name", "value")
robservable(
"@juba/robservable-bar-chart",
include = "chart",
input = list(
data = df,
x = "value",
y = "name"
)
)