View source: R/check_crucial_names.R
check_crucial_names | R Documentation |
It is based on: https://www.rdocumentation.org/packages/fgeo.tool/versions/1.2.5/topics/check_crucial_names.
check_crucial_names(x, expected_names)
x |
A named object. |
expected_names |
String; expected names of |
Invisible x
, or an error with informative message.
Other miscellaneous utility functions:
degrees()
,
dropbox_exists()
,
path_examples()
,
r2dii_packages()
x <- c(a = 1) check_crucial_names(x, "a") try(check_crucial_names(x, "bad")) data <- data.frame(a = 1) check_crucial_names(data, "a") try(check_crucial_names(data, "bad")) # Applications for the error class "missing_names" --------------------- tryCatch( check_crucial_names(x, "bad"), error = function(e) class(e) ) # Wrapping in try() to allow running examples with no failure try( # What's interesting is this tryCatch( check_crucial_names(x, "bad"), missing_names = function(e) { stop( "A different error message", call. = FALSE ) } ) ) testthat::expect_error( check_crucial_names(x, "bad"), class = "missing_names" )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.