A report's data step or content step may be the user's own R code (the
report sheet's data_code / content_code: a step whose code is not
blank is its code). The code follows rules the program around it
relies on: the datasets it reads are the report's (registered in its
data step: the program reads them first, by their names in lower case),
this report's ARD rows are ard when the report reads its ARD, and the
step leaves the object the next one reads – the data step data (a
table or a listing; a table's may leave ard alone, which the program
normalizes) or df (a figure), the content step content.
The check reads the code; it does not run it.
Arguments
- code
The code: a string (lines joined by newlines) or a character vector of lines.
- step
"data"or"content".- type
The report's type:
"table","listing"or"figure".- datasets
The datasets the report registers (any case).
- catalog
The datasets of the study's catalog (any case): a name of these the code uses and does not make itself must be registered.
- ard
Whether the report reads its ARD (
ardis in reach).- output_id
The report, for the messages.
Value
A tfl_review (tfl_review_spec()'s rows: sheet report,
field data_code / content_code), with the attribute datasets:
the catalog's datasets the code uses (upper case), registered or not.
Details
The rules (tfl_review_rules(), area program):
U01 (error): the code does not read as R.
U02 (error): it names a dataset of the catalog the report does not register.
U03 (error): it leaves nothing for the next step (no assignment to
data/df/content).U04 (check): it reads files itself, attaches packages or changes the session (
readRDS(),haven::read_xpt(),library(),setwd(),options()...).U05 (error): it uses
ard, but the report does not read its ARD.