| set_up | R Documentation | 
When check_arg (or stop_up) is used in non user-level functions, the argument .up is used to provide an appropriate error message referencing the right function.
set_up(.up = 1)
| .up | An integer greater or equal to 0. | 
To avoid repeating the argument .up in each check_arg call, you can set it (kind of) "globally" with set_up.
The function set_up does not set the argument up globally, but only for all calls to check_arg and check_value within the same function.
# Example with computation being made within a non user-level function
sum_fun = function(x, y){
  my_internal(x, y, sum = TRUE)
}
diff_fun = function(x, y){
  my_internal(x, y, sum = FALSE)
}
my_internal = function(x, y, sum){
  set_up(1) # => errors will be at the user-level function
  check_arg(x, y, "numeric scalar mbt")
  # Identical to calling
  # check_arg(x, y, "numeric scalar mbt", .up = 1)
  if(sum) return(x + y)
  return(x - y)
}
# we check it works
sum_fun(5, 6)
diff_fun(5, 6)
# Let's throw some errors
try(sum_fun(5))
try(sum_fun(5, 1:5))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.