append_content | R Documentation |
Append content of baton instead of replacing the list content via modifyList()
. Typically this can be done right at the
time when passing the baton, sent to the 'content' parameter. Using this function should help ease the process of replacing items
nested within the list, though it is possible to do this manually too. It is recommended to always review the new content after
appending prior to passing the baton to ensure the process occurred as expected. If vector lengths or depths are not exact, there
could be unexpected entries.
append_content(baton, content_name = NULL, new_content, all_content = TRUE)
baton |
R object of S3 class, created by |
content_name |
Character vector in order of nested list component of existing baton content. |
new_content |
Named list for new content to append to existing baton content, without replacing. |
all_content |
Boolean, to decide if all content is returned or just the sections modified. |
List of the new content that should be appended when passing the baton
## Not run:
# Assuming there is an existing baton with content under 'data'...
# Create some content to put under data, and already exists to append...
baton_content <- list('time_created' = Sys.time()))
# Pass baton and do appending at same time
baton_example <- pass_baton(baton_example, content = append_content(baton_example, 'data', baton_content))
# If need to append as well as add new content before passing, combine the append_content to another list
new_content <- append(append_content(baton_example, 'data', baton_content), list('new_content' = 'This is new content'))
baton_example <- pass_baton(baton_example, content = new_content)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.