Turns the map into a story the reader plays step by step, with a caption for each step. Without steps, the map
has one step per stage and shows no player. Adding steps brings the step player, unless stage_map() was given
player = FALSE.
Arguments
- map
A
stage_map()widget.- steps
A data frame with one row per step, in playing order. See "Columns".
NULL, or a data frame with no rows (such asdata.frame()), adds no steps and no player.- ...
Must stay empty. It makes every argument after it a named argument.
- changes
A data frame with one row per card per step, or
NULL(or no rows) for steps that change no card. Everychanges$stepmust be an id insteps$id, everychanges$cardan id in the map'scards$id, everychanges$stagean id in itsstages$idand everychanges$statusa status of the map; a card can change once at a step. An id that does not match, or a card changed twice at a step, is an error of classstagemap_error_datathat names the ids or rows.changeswithoutstepsis an error of classstagemap_error_layer. See "Columns".- intro
The caption shown before the first step, as one string, or
NULLfor none. Added only withsteps.
Value
The widget, with the steps added. A widget that has steps already is an error of class
stagemap_error_layer. A stage of a step that is not a stage of the map, a step of a link that is not in
steps, and an id given twice in steps, are errors of class stagemap_error_data that name the ids.
Details
A step can also change cards. changes lists, for each step, the cards whose status, stage or visibility change
when the reader reaches it, and they keep the change in the steps after it. A card moved to another stage glides
there, following the map's motion (see stage_map()). The change shows in the picture as a map drawn again at that
step.
Columns
Required columns are marked with an asterisk.
steps:id*,label*,kicker,text,stage(the stage the step is about),file,code,code_lines(a file's text and the lines to mark, as for a stage).changes:step*(astepsid),card*(a card id from the map'scards),status(a status id, see the "Statuses" section ofstage_map()),stage(a stage id: the card moves there),hidden(TRUEhides the card,FALSEshows it again). One row per card per step.NAinstatus,stageorhiddenleaves that property as it was; a status can be changed to another, but not cleared.
See also
Other stage map:
add_links(),
add_variants(),
add_zones(),
stage_map(),
stage_map_code(),
stage_map_tables()
Examples
map <- stage_map(
cards = data.frame(id = "a", label = "Draft", stage = "w", lane = "docs", status = "running"),
stages = data.frame(id = c("w", "c"), label = c("Write", "Check")),
lanes = data.frame(id = "docs", label = "Docs")
) |>
add_steps(
data.frame(id = c("one", "two"), label = c("The draft starts", "The draft moves on")),
changes = data.frame(step = "two", card = "a", status = "done", stage = "c"),
intro = "How the notes were written"
)
class(map)
#> [1] "stage_map" "stagemap_widget" "htmlwidget"
if (FALSE) { # interactive()
map
}