read_metadata | R Documentation |
Read the metadata content of a baton, either in the environment, or from a file source. This has some functional overlaps with summary
but
is specific to the metadata section. This function will not alter the metadata content, and is a read-only operation. If you want to read log information
try read_logbook
.
read_metadata(baton, loc = NULL, subset = NULL)
baton |
R object of S3 class, created by |
loc |
file path to clear YAML files related to baton tracking. |
subset |
a integer or character vector of metadata elements to return (defaults to ALL elements). Elements include: id, relay_start, relay_finish, all_passes, pass_complete, passes_completed, location, and dropped. |
## Not run:
batons_loc <- locate_batons('/location/where/bundlesorbatons/live', recursive = TRUE, full.name = TRUE)
# Grab metadata of interest to determine which to load
baton_meta_pass <- purrr::map_lgl(batons_loc, ~unlist(read_metadata(loc = ., subset = c('pass_complete'))))
baton_meta_finish <- purrr::map_chr(batons_loc, ~unlist(read_metadata(loc = ., subset = c('relay_finish'))))
# Equivalent in base R
baton_meta_pass <- vapply(batons_loc, function(x) unlist(read_metadata(loc = x, subset = c('pass_complete'))), logical(1), USE.NAMES = F)
baton_meta_finish <- vapply(batons_loc, function(x) unlist(read_metadata(loc = x, subset = c('relay_finish'))), character(1), USE.NAMES = F)
# Determine which baton to keep!
select_baton <- batons_loc[which(baton_meta_finish == max(baton_meta_finish) & baton_meta_pass)]
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.