val_var: Validate variables

Description Usage Arguments Author(s) See Also Examples

View source: R/val_var.R

Description

Validates variables before further procedure execution.

Usage

1
val_var(test_var, type, force = 2, size = 0, def = FALSE)

Arguments

test_var

Multiple. The variable that is to be tested.

type

Character. The variable type determined by mode or lubridate::is.POSIXct. For example numeric, character, logical, list, POSIXct or ggplot.

force

numeric. Error message is sent as warning (1) or stop (2).

size

numeric. If size is not 0 the length of test_var will be checked with size.

def

logical. Ignore this check if cname = "".

Author(s)

Benjamin Ziepert

See Also

val_cname,val_psyo, val_var

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## Not run: 
# 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


## End(Not run)

psyosphere documentation built on July 2, 2020, 12:08 a.m.