Compares the current state with a read answer (tfl_ai_parse()), item
by item, for a review where each item is accepted or rejected.
Arguments
- current
What there is now:
toc, a data frame of TOC rows (tfl_read_toc()'s fields as columns;NULLfor none);figure, atfl_fig_design()(NULLfor none). Atfl_ai_answeris accepted too.- answer
A
tfl_ai_answer, or whatcurrentis.- task
One of
tfl_ai_tasks(); by default the answer's.
Value
A data frame, one row an item and, for a changed item, one a
changed field: part (toc, or the section), key (the output id;
the piece's name, with #2 for a second one of a name), status
(added, changed, removed, moved, same), field, was,
now (for changed the field's values; for moved the positions).
Details
toc: the rows matched byoutput_id; a changed row has one row a changed column.figure: the pieces of each section (data,layers) matched by theirstep/layername in order of appearance (the secondpointlayer with the second); the figure-wideplotsettings as one piece, field by field; the design'stemplate,ggplot2_versionandcomposeas the piecedesign. A piece that keeps its fields but changes its order relative to the others ismoved(one inserted in the middle moves nothing). A composed figure's plots are compared plot by plot (plots$km/layers...).
Examples
cur <- tfl_fig_template("km_simple")
new <- cur
new$layers <- c(new$layers, list(list(layer = "censor_mark", shape = "x")))
new$plot$x_label <- "Time (Months)"
d <- tfl_ai_diff(cur, new, "figure")
d[d$status != "same", ]
#> part key status field was now
#> 10 layers censor_mark#2 added <NA> <NA> 3