This document lists useful tips for targets package function usage.
tar_load_globals()
tar_load_globals()loads user-defined packages, functions, global objects, and settings defined in the target script file (default:_targets.R). This function is for debugging, testing, and prototyping only. It is not recommended for use inside a serious pipeline or to report the results of a serious pipeline.
tar_workspace()
tar_workspace()only works if you tell targets to save the workspace for that target. Which means the target has to be explicitly named intar_option_set(workspace = c("target_name_one","target_name_two"))- However,
tar_option_set(workspace_on_error = TRUE)saves the workspace if the target errors. - So say target
target_name_oneerrors, you could dotar_workspace(target_name_one)and it will load that workspace and you can debug it there.
tar_load()
tar_load()works with tidy selectors.
# So you can do this:
tar_load(c(reference_group_local, focal_group_local, gender_label))
# or this:
tar_load(ends_with("local"))
Leave a Reply