val_var {psyosphere} | R Documentation |
Validates variables before further procedure execution.
val_var(test_var, type, force = 2, size = 0, def = FALSE)
test_var |
Multiple. The variable that is to be tested. |
type |
Character. The variable type determined by |
force |
numeric. Error message is sent as warning (1) or stop (2). |
size |
numeric. If |
def |
logical. Ignore this check if |
Benjamin Ziepert
# Create variables id <- 10 name <- "test" time <- as.POSIXct("1986-08-31 02:15:00") # Check variables # e <- val_var(id, "character"); if (e != "") {stop(e)} # error and stop # e <- val_var(name, "logical", FALSE); if (e != "") {stop(e)} # error and warning e <- val_var(time, "POSIXct"); if (e != "") {stop(e)} # no error