var_table | R Documentation |
StudySpecification
Methods to extract the variable names to the elements of the
structure of the StudySpecification
(e.g. treatment, unit of
analysis, etc)
var_table(specification, compress = TRUE, report_all = FALSE)
var_names(specification, type, implicitBlocks = FALSE)
specification |
a |
compress |
should multiple variables be compressed into a
comma-separated string? Default |
report_all |
should we report all possible structures even if they
don't exist in the |
type |
one of "t", "u", "b", "f"; for "treatment", "unit_of_assignment", "block", and "forcing" respectively |
implicitBlocks |
If the |
When compress
is TRUE
, the result will always have
two columns. When FALSE
, the result will have number of columns
equal to the largest number of variables in a particular role, plus one.
E.g., a call such as rct_spec(z ~ unitid(a, b, c, d) ...
will have
4+1=5 columns in the output matrix with compress = FALSE
.
When report_all
is TRUE
, the matrix is guaranteed to have 3
rows (when the specification
is an RCT or Obs) or 4 rows (when the
specification
is a RD), with empty variable entries as appropriate.
When FALSE
, the matrix will have minimum 2 rows (treatment and unit
of assignment/unitid/cluster), with additional rows for blocks and forcing
if included in the StudySpecification
.
var_table
returns the requested table. var_names
returns a vector of variable names.
spec <- rct_spec(z ~ uoa(uoa1, uoa2) + block(bid), data = simdata)
var_table(spec)
var_table(spec, compress = FALSE)
var_names(spec, "t")
var_names(spec, "u")
var_names(spec, "b")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.