Writes what the ARD spec analyses – and, when given, what the table and
report specs say of each output – as the CDISC Analysis Results
Standard (ARS) v1.0 model: a ReportingEvent with its analysis sets,
data subsets, groupings, methods, analyses, outputs and list of
contents. tfl_write_ars_json() writes it as the ARS JSON, the form
the standard is exchanged in; tfl_check_ars() checks it. The specs
stay the source: the ARS is written from them, not edited.
Usage
tfl_ars(
ard_spec,
table_spec = NULL,
report_spec = NULL,
profile = c("cdisc", "siera"),
study_id = NULL,
purpose = NULL,
reason = "SPECIFIED IN SAP",
dataset_names = NULL,
dir = ".",
references = NULL,
columns = NULL
)Arguments
- ard_spec
An ARD spec (
tfl_read_ard_spec()).- table_spec, report_spec
Optional table / report specs (
tfl_read_table_spec(),tfl_read_report_spec(); one object may be given for both): the levels of a grouping, and each output's titles, footnotes, header, footer and file.- profile
"cdisc": the layout of CDISC's examples."siera": the same, made runnable by siera'sreadARS()(still valid CDISC ARS): each method carries an R code template, a proportion with its CI is an analysis of the variable, each output's subject count comes first, ids keep only letters, digits and_, and the list of outputs is there. An analysis siera has no template for (a test other than chi-square,missing,mean_ci,custom...) is left out and listed bytfl_ars_unmapped().tfl_ars_ard()runs it.- study_id
The reporting event's id; default the ARD spec's
studykeystudy_id, else"STUDY".- purpose, reason
For analyses whose
purpose/reasonis blank: one of the CDISC terms, orNULL.reasondefaults to"SPECIFIED IN SAP".- dataset_names
A named character vector: the ADaM name the ARS uses for a spec dataset (default: the spec's name in upper case).
- dir
The study folder: the files of the study key
source(its own ARD functions) are read from it – not run – for the statistics a function says it gives (cards::as_cards_fn(stat_names = )).- references
The outputs that print another output's analyses (a figure printing a table's median and hazard ratio, #293): a data frame with
output_id(the figure),source(the table) andanalysis_id(the table's analysis), a row each. Such an output is an ARSOutput(its displays and file, from the report spec) whose list of contents names the source's analyses – they are not written twice; one whose analyses are not in the ARS is listed bytfl_ars_unmapped().- columns
profile = "siera": the datasets' columns, a named list (list(ADSL = names(adsl), ...)); with it, an output grouped by a column its dataset does not have (one the spec derives: ARS has no derivation) is one siera cannot run.NULL: not checked.
Value
A tfl_ars: the reporting event as a nested list, with
attributes profile, unmapped (a data frame where, item,
reason: what the ARS does not say) and ids (each spec analysis and
the ARS analyses written for it).
Details
The layout follows CDISC's own example (Common Safety Displays):
a population is an
AnalysisSet, an analysis'swhereaDataSubset(an R condition on one variable at a time, joined by&,|,!, becomes aWhereClause);each
byvariable is anAnalysisGrouping; its groups are listed (anddataDriven = FALSE) when the table spec gives the variable'slevels;a continuous variable is an analysis of the variable; a categorical one an analysis of the subject key grouped by the variable, its percentage pointing at the output's subject count by group as its denominator (added, and said in
unmapped, when the output has none);a hierarchy (SOC / PT) is one analysis per depth;
each method is an
AnalysisMethodwhose operations are its statistics; acustomorpkg::functionmethod carries its code as the method'scodeTemplate.
purpose and reason are the SAP's decisions, so they come from the
analyses' own purpose / reason columns (or the arguments), never
guessed. ARS requires a purpose: an analysis without one is written
without it and tfl_check_ars() names it.