This function determines the behaviour to adopt when labelled variables of a
safeframe
are lost for example through subsetting. This is achieved using
options
defined for the safeframe
package.
Usage
lost_labels_action(action = c("warning", "error", "none"), quiet = FALSE)
get_lost_labels_action()
Details
The errors or warnings generated by safeframe in case of labelled
variable loss has a custom class of safeframe_error
and safeframe_warning
respectively.
Examples
# reset default - done automatically at package loading
lost_labels_action()
#> Lost labels will now issue a warning.
# check current value
get_lost_labels_action()
#> [1] "warning"
# change to issue errors when tags are lost
lost_labels_action("error")
#> Lost labels will now issue an error.
get_lost_labels_action()
#> [1] "error"
# change to ignore when tags are lost
lost_labels_action("none")
#> Lost labels will now be ignored.
get_lost_labels_action()
#> [1] "none"
# reset to default: warning
lost_labels_action()
#> Lost labels will now issue a warning.