| data_card | R Documentation |
Describes a clone in a data card (card version 0.1): its size, its design columns and, for each column, a role, a kind and counts. An analysis planner can read the card in place of the data. No value of any column is written: a factor's levels are counted, never listed.
data_card(
m,
file = NULL,
name = NULL,
env = NULL,
spatial = NULL,
unit = NULL,
primary_event = 1L
)
m |
A |
file |
Where to write the card in YAML, or |
name |
The table name on the card. Defaults to |
env, spatial, unit |
Optional names of clone columns: the environment
columns (trials, sites, years), the columns giving a spatial or temporal
position, and the one column identifying the unit of repeated
measurement. Environment columns must have the role |
primary_event |
Which event pair of the first |
The card is computed from the clone alone: synthetic(), the role table
from roles(), the mode, the package version and the column names of any
events spec given to mask(). No other part of the private recipe is
read, so the card can travel with the clone. On a clone whose column
names were aliased, the card uses the aliases throughout.
The card as a list, invisibly when file is given. For a set, a
named list of cards, one per table.
The design block is copied from the role table, never re-detected. The
treatment columns are those with the role treatment, and the block
columns those with the role design, less any named in env,
spatial or unit. Environment, spatial and unit columns are named by
the caller, since the role table does not tell them apart from blocks.
No design class is written. For a linked-event spec, the event pair
chosen by primary_event gives the event time and status columns, the
other status columns of that spec are listed as competing, and the card
records the number of rows with the primary status equal to 1 and the
share of rows with neither the primary nor a competing event (censored).
Every statistic carries a provenance class.
structure: exact in the clone, so equal to the same statistic on the
original table. Row and column counts, missing counts and shares, the
level counts and zero shares of kept and aliased columns and of event
status columns, the treatment, block and event columns, the
environment count and the event count.
clone_estimate: re-simulated, so approximate. The level counts and
zero shares of scrambled columns, including event times, and the
censored share.
analyst: named in this call: the environment, spatial and unit
columns.
The card is written by a small deterministic writer: keys in the order of
the contract, every string double-quoted and escaped, counts as integers,
shares with six decimals, UTF-8 with \n line ends. The same clone gives
the same bytes.
roles(), synthetic(), mask(), mask_set().
r <- propose_roles(iris)
r <- set_role(r, "Species", role = "treatment", action = "alias")
r <- set_role(r, "Sepal.Length", role = "outcome")
m <- mask(iris, r, seed = 1)
card <- data_card(m)
card$table
card$design
path <- tempfile(fileext = ".yaml")
data_card(m, file = path)
head(readLines(path), 12)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.