sideviewUI() and sideviewServer() put an R-backed sideview canvas into your
own Shiny app (several per page). Row sorting and filtering, lazy arrow/duckdb
cards, the join check and the column inspector all run in R, as in sideview().
Tables are added, replaced and removed from the server with the verbs
sv_add_card(), sv_replace_card() and sv_remove_card(); the user's work is
read back with the reactives of the returned proxy.
Arguments
- id
Module id.
- height
CSS height of the canvas, e.g.
"600px".- title
Text shown in the toolbar;
NULL(the default) shows none.- theme
"auto","light","dark", ansv_theme()or abslib::bs_theme().- view
Starting view:
"canvas"(default, the pan/zoom canvas) or"list"(a text-first list of the tables, for keyboard and screen-reader use). The default isgetOption("sideview.view", "canvas"). A workspace restored later (Open) that records a view switches to it.- access
TRUEstarts with the Accessible canvas switch on (defaultgetOption("sideview.access", FALSE)); the switch in the?list is remembered in the browser and wins.- cards
Tables for the canvas: a (named) list as
sideview()takes, or a reactive returning one. A reactive is compared with the canvas by name each time it fires: new names are added, names that are gone are removed, and names still there are replaced unless the table isidentical()to the one on the canvas.- state
A saved workspace applied once after the first cards arrive: a state object, or its JSON text (a string whose first non-blank character is an opening curly brace).
- llm_fn
Function used for the AI bar and the copilot (as for
sideview()). With none, the server tells the canvas to hide the AI bar and the Copilot tab.sideviewUI()always renders them, so they show for a moment before the first message arrives.- cdisc
CDISC tagging, as for
sideview():"auto",FALSE, or a named character vector of domain codes. Tags are kept current as cards come and go.- code_style
"dplyr"(default) or"pharmaverse": the starting style of the generated code, sent to the canvas beforestate. A workspace state, with or without a recorded style, sets the style, and one without a style loads as"dplyr":code_styleis only the starting style when nostateis applied. It changes the code the browser composes, nothing R evaluates.
Value
sideviewUI() returns a shiny.tag.list. sideviewServer() returns a
sideview_proxy: a list with the reactives code() (the composed code, ""
for none), pipeline() (the typed steps as a list), state() (a state object,
or NULL before the first change) and cards() (the card names), plus id,
ns and session. The values update after the user's changes settle (300 ms).
Details
Code execution is off in a module (Insert Script, Run & Exit, Run in R and Run
Console are not rendered, and their inputs are ignored by the server). The
composed $code() is built in the browser: treat it as untrusted text to show,
save or review, never eval() it unattended.
One server per id
Calling sideviewServer() twice with the same id in one session replaces the
first canvas's entry in the proxy registry: sideviewProxy() then reaches the
second. Give each canvas its own id.
Examples
if (interactive()) {
library(shiny)
ui <- fluidPage(sideviewUI("cv"), verbatimTextOutput("code"))
server <- function(input, output, session) {
px <- sideviewServer("cv", cards = list(cars = mtcars, flowers = iris))
output$code <- renderText(px$code())
}
shinyApp(ui, server)
}
