Helpers

Functions

  • get-alt-text - Read the alt text stored on a plot spec.
  • qnorm - Inverse of the standard-normal cumulative distribution function.
  • resolution - Smallest non-zero gap between unique numeric values in values.

Binning helpers

  • cut-interval - Cut a numeric vector into n equal-width bins.
  • cut-number - Cut a numeric vector into n bins of (approximately) equal count.
  • cut-width - Cut a numeric vector into bins of fixed width.

Data wrangling

  • anti-join - Keep the rows of x that have no match in y, adding no columns.
  • bind-cols - Glue datasets side by side (column bind).
  • bind-rows - Stack datasets on top of each other (row union).
  • count - Count the rows in each group, one output row per group.
  • distinct - Keep the first row of each distinct combination of the named columns.
  • drop-na - Drop rows carrying a missing value in the named columns.
  • full-join - Keep every row of both x and y, matching on the key columns.
  • inner-join - Keep only the rows of x and y that share a key.
  • left-join - Keep every row of x, adding the matching columns from y.
  • pivot-longer - Melt several columns into a single name/value column pair (wide to long).
  • pivot-wider - Spread a name column and a value column into one column per name (long to wide).
  • relocate - Move columns to a new position, keeping their values and every other column.
  • rename - Rename columns, leaving every other column and the column order unchanged.
  • select - Keep only the named columns, in the given order.
  • semi-join - Keep the rows of x that have a match in y, adding no columns.
  • slice-max - Keep the n rows with the largest value of col.
  • slice-min - Keep the n rows with the smallest value of col.
  • summarise - Collapse each group of rows to a single row of named aggregations.

Formatters

  • format-comma - Shorthand for format-number(big-mark: ",").
  • format-currency - Format a numeric break as currency.
  • format-lower - Lower-case a string break (ASCII letters only).
  • format-number - Format a numeric break with optional thousands separator and decimals.
  • format-percent - Format a numeric break as a percentage.
  • format-scientific - Format a numeric break in scientific notation as Typst math.
  • format-title - Title-case a string break: capitalise the first letter of each space-separated word.
  • format-upper - Upper-case a string break (ASCII letters only).
  • format-wrap - Soft-wrap a long string by inserting a newline at word boundaries.

Summary functions

  • mean - Mean as a degenerate summary (y, ymin: y, ymax: y).
  • mean-cl-boot - Mean with a bootstrap percentile confidence interval.
  • mean-cl-normal - Mean with normal-approximation confidence interval.
  • mean-sd - Mean and standard-deviation band: mean ± multiplier * sd.
  • mean-se - Mean and standard-error band: mean ± multiplier * se.
  • median - Median as a degenerate summary (y, ymin: y, ymax: y).
  • median-hilow - Median plus a central interval covering conf proportion of the data.
  • quantile - Single quantile as a degenerate summary (y, ymin: y, ymax: y).
  • quantiles - Three quantiles packed into the standard summary shape.
Back to top