Skip to content

blockr.viz

Interactive, dashboard-grade output: charts with built-in aggregation and drilldown, tables, tiles and summary tables. Clicking a chart filters what is downstream of it. The right choice when people explore your board rather than read it.

Summary Table

new_summary_table_block() · transform

Wide, display-shaped multi-variable summary (list of variables by Y pattern). Successor to tidy_summary_block.

ArgumentDescription
varsCharacter, variables to summarise — each becomes a row-section. Handles numeric, categorical, and logical columns; logicals are rendered as a one-row TRUE count for pharma flag variables.
sectionsCharacter, OUTER grouping columns that CONTAIN the vars, 0..N — use ONLY for a true nesting hierarchy such as SOC containing PT; leave empty for a flat list of variables.
byCharacter, column-split dimensions, 0..2.
statsStatistics emitted for each NUMERIC variable, any combination of: "n", "n_pct" (non-missing n and % of group rows), "mean", "sd", "mean_sd", "median", "median_q1_q3", "q1_q3", "min_max". ONE key = a single row per var...
add_overallLogical, append an overall column across all by levels.
overall_labelLabel for the overall column, default "Total".
indent_detailsLogical, default TRUE — indent detail rows under their variable header; rarely changed.
nest_hierarchiesLogical, default FALSE — advanced row-side drill-down for adjacent functionally-dependent categorical vars; leave FALSE unless asked.
id_varOPTIONAL subject-identifier column name, e.g. "USUBJID": when set, counts and percentages are over DISTINCT values of this column instead of row counts — set it whenever the data is event-level/long, i.e. multiple row...

Chart

new_chart_block() · plot

Configurable chart with click-to-filter drill-down

ArgumentDescription
chart_typeChart type. One of "bar", "waterfall", "pie", "treemap", "boxplot", "radar" (aggregated — use group + value + func), "scatter", "line" (individual — use x + y), or "gantt" (timeline — use x + xend + y). Default "bar"....
groupColumn for the categorical axis (aggregated charts). Names a data column, never a literal.
colorColumn mapped to colour. All families. Names a data column, never a literal colour. null for no colour mapping.
facetColumn to facet by — one small panel per level. Optional.
valueColumn to aggregate (aggregated charts only). Must match func: ".count" with func "count" (row counts; the value is ignored otherwise), any column with "count_distinct" (e.g. a subject id such as USUBJID to count pa...
funcAggregation function for value (aggregated charts only). One of "count", "count_distinct", "mean", "median", "sum", "min", "max". Default "count" (row count; ignores value). "count_distinct" counts distinct `value...
xX-axis column (individual: scatter/line; timeline: interval start). Names a data column.
yY-axis column (individual: scatter/line; timeline: the lane, e.g. USUBJID). Names a data column.
seriesColumn whose distinct values split rows into separate series (individual: one line/scatter group per value; timeline: per-bar label). Splits only — not a colour, not a drill target. Independent of color. High cardinal...
xendInterval end column (timeline only). Rows with no end render as a dot at x.
labelColumn written as on-mark text. Optional; default null = no on-mark text. For pie/treemap, null falls back to group (a label-less pie is unusable). Label only — does not affect colour, series, or drill.
tt_fieldsExtra column names appended to each mark's hover tooltip, beyond the mapped roles (timeline/gantt). Display-only — never affects the plot; a listed column dropped upstream is silently omitted. Empty = no extra tooltip...
drillDrill-down: what a SELECTION (click or brush) filters downstream on. Tri-state: null/"" = OFF (the chart is a static display — no filter, no hover effect; the default); "auto" = ON with the family's natural target (ag...
ctrl_targetBETA. Block id of a value filter block on the SAME board: a categorical drill click's claim (e.g. SEX = F) is also pushed into that block over the board's control channel, so the drill filters a pipeline the chart has...
ctrl_tableBETA. Only with ctrl_target: the table in the target's dm the pushed conditions apply to (e.g. "adsl"). Leave empty when the target filters a plain data frame.
smootherTrend overlay for scatter charts. One of "none" (default), "lm" (linear fit) or "loess" (local regression).
identity_lineIdentity-line overlay for scatter charts: true draws a dashed 45-degree y = x guide line, false (default) omits it. Use for shift or agreement plots (e.g. baseline vs post-baseline).
box_pointsObservation overlay for boxplots (chart_type="boxplot"): "none" (default, box only), "outliers" (plot only the points beyond the 1.5x IQR whiskers) or "all" (a jittered strip of every observation drawn over the box). ...
loLower error-band column (individual line only). Set together with hi to draw a band; numeric only.
hiUpper error-band column (individual line only). Set together with lo to draw a band; numeric only.
stepStep-line mode for line charts. null (default) draws straight segments; "start", "middle" or "end" draw a stepped line (where along the interval the vertical jump happens). Use for values that hold between observation...
vlinesHelper lines: each number draws one dashed VERTICAL guide line at that x position (e.g. a threshold like 5). Plain numbers, never column names. Empty = no vertical lines. Scatter/line charts.
hlinesHelper lines: each number draws one dashed HORIZONTAL guide line at that y position (e.g. a normal-range limit). Plain numbers, never column names. Empty = no horizontal lines. Scatter/line charts.
line_width_multLine width multiplier for line charts (individual only). 1.0× is the default look; range 0.5×–3.0×.
dot_size_multMarker size multiplier for scatter points and line markers (individual only). 1.0× is the default; range 0.5×–3.0×.
filter_typeRuntime filter-transport state. Normally left at default "categorical"; set by interaction, not at creation.
filter_columnRuntime filter-transport state. The column the last click filtered on. Usually null at creation.
filter_valuesRuntime filter-transport state. Values kept after the last click. Usually null at creation.
filter_rangeRuntime filter-transport state for brush/drag on scatter/line (x_col, y_col, x_range, y_range). Usually null at creation.
filter_pointRuntime filter-transport state for a single-point click on a scatter with no drill column (x_col, y_col, x_val, y_val). Usually null at creation.
sort_byCategory-axis ordering for aggregated charts. "value" (default), "alpha", or a column name. For timeline: "onset" (default), "alpha", or a column name. Ignored for individual (scatter/line) charts.
sort_dirDirection for sort_by. One of "asc" or "desc". Ignored for individual (scatter/line) charts.
orientationBar orientation: "horizontal" (default; category on the y-axis, best for long labels) or "vertical". Presentation only — the group/value mapping is unchanged. Bar charts only.
bar_modeLayout for a color-split bar: "stacked" (default — color segments stack into one bar per group), "grouped" (segments sit side-by-side / dodged, for comparing absolute values), or "percent" (stacked but each group norm...
baselineBar baseline mode: "zero" (default — every bar starts at 0) or "cumulative" (a waterfall/bridge — each bar floats from the running cumulative of the bars before it; each value is a DELTA and the step axis honors data ...
waterfall_totalsGroup (step) values rendered as total/subtotal bars in a cumulative-baseline bar: their baseline resets to 0 and they show the absolute running cumulative (e.g. ["Profit"] in a Revenue -> Costs -> Profit bridge). Empt...

Tile

new_tile_block() · plot

Scorecard of bold KPI numbers — cards or an aligned matrix, with deltas / fills / status pills and click-to-filter drill. A pure renderer (shape upstream).

ArgumentDescription
valueNumeric column(s) shown as the big number. One column for a long tile frame; MULTIPLE columns for wide input (each column becomes a measure / card, measure name = column name). Required.
groupGrouping column: clusters cards / drives the matrix rows, and is the dplyr::group_by column when summaries aggregate the input in place. One column (a KPI clusters by a single dimension). Optional; "" = a single ung...
nameThe column NAMING each KPI, for LONG input (one row per group x measure); the name shows above the value and drives per-KPI number formatting and the matrix columns. Leave "" for wide input — then the value column n...
colorCategorical identity color ("Color by") -- the SAME argument as the chart's color, applied to cards: the tile's group column or its name column; each card / matrix row gets a scale-map accent in that value's col...
summariesIn-block aggregations shown as cards: a list, each entry {func, cols}. func is one of "count", "count_distinct", "mean", "median", "sum", "min", "max"; cols the numeric column(s) it reduces. Empty cols on a NU...
layoutLayout: "cards" (grid of cards) or "table" (aligned matrix).
secondaryA PRECOMPUTED reference column drawn beside the value (a delta, a fraction, a status). The renderer does no arithmetic — compute the comparison upstream. Optional; "" = no secondary.
styleHow to draw the secondary: "plain" (show the reference), "delta" (arrow + %, colored by sign), "fill" (progress bar to a fraction), "pill" (status chip).
formatHow the NUMBER is formatted (never a currency guess): "number" (separators + smart decimals, default), "compact" (1.2M / 38.4K), or "percent" (a fraction x100 + %).
unitFree-text unit label shown next to the value / in the matrix header (e.g. "USD", "CHF", "apples", "kg"). This is how you label a currency — the renderer never infers "$".
captionSubtext below the value: a column name (per-cell) or a literal.
drillWhen TRUE, clicking a card / matrix row emits a categorical filter downstream (the same contract as the chart / table). The filter column is determined by the tile's structure, never picked: the group column when gr...
ctrl_targetBETA. Block id of a value filter block on the SAME board: the drill's claim (e.g. SEX = F) is also pushed into that block over the board's control channel, so the drill filters a pipeline the tile has no data link to....
ctrl_tableBETA. Only with ctrl_target: the table in the target's dm the pushed conditions apply to (e.g. "adsl"). Leave empty when the target filters a plain data frame.

gt Table

new_gt_table_block() · table

Render wide-format tables (from summary_table) as styled gt tables — static / print / CSR output.

ArgumentDescription
titleTable title rendered above the table. Empty string for no title.
subtitleSubtitle rendered under the title. Empty string for no subtitle.
full_widthLogical. TRUE (default) makes the table span the container width.
bordersLogical. TRUE (default) draws 2px top/bottom/heading borders in the pharma SAP style.
na_repString used to render missing (NA) cells. Default is an em dash.

Table

new_table_block() · table

Interactive table (sticky header, sort, search) with optional cell coloring and click-to-filter drill-down

ArgumentDescription
groupGrouping column(s) to aggregate over. One or more categorical columns (nested from outer to inner). Empty = no grouping (a raw row-level table).
summariesThe aggregations shown: a list, each entry {func, cols}. func is one of "count", "count_distinct", "mean", "median", "sum", "min", "max"; cols is the numeric column(s) it reduces. One entry per aggregation, so m...
rownameThe single column shown as the row labels (the left-hand stub). Names a data column; defaults to the first column.
valueThe columns rendered as the table body (the data cells). When the user names specific value/measure columns, set this to EXACTLY those columns -- do not leave it null. Leave null only to mean 'all columns except `rown...
colorCategorical identity color ("Color by") -- the SAME argument as the chart's color, applied to rows: names one categorical column whose values tint the rows through the board scale map, so a SEX-colored table matches...
shadingsCell value-encoding rules: a list, each entry {mode, cols} (same shape family as summaries). mode is "diverging" (correlation matrices, centred on 0), "sequential" (heatmaps), or "bar" (an in-cell data bar propo...
drillRow-click drill-down. Optional; default null = a click is inert (drill is opt-in everywhere). RAW table: a column name — clicking a row emits a categorical filter on that column's value (the same filter contract as th...
digitsDecimal places for numeric display. Default 2.
ctrl_targetBETA. Block id of a value filter block on the SAME board: the drill's claim (e.g. SEX = F) is also pushed into that block over the board's control channel, so the drill filters a pipeline the table has no data link to...
ctrl_tableBETA. Only with ctrl_target: the table in the target's dm the pushed conditions apply to (e.g. "adsl"). Leave empty when the target filters a plain data frame.