val_cname: Validate the column name of a data frame

Description Usage Arguments Value Author(s) See Also Examples

View source: R/val_cname.R

Description

Validate the column name of a data frame

Usage

1
val_cname(tracks, cname, type = "", size = 0, force = 2, def = TRUE)

Arguments

tracks

psyo. Data frame with tracks.

cname

character. Column name of column in tracks that is to be validated.

type

character. Type of column in tracks determined by mode.

size

size. Observation count of column in tracks determined by length.

force

numeric. An error with force_id will be reported as stop when 2, warning when 1 or nothing when 0.

def

logical. Ignore this check if cname = "".

Value

character

Author(s)

Benjamin Ziepert. Please send feedback to: feedback-psyosphere@analyse-gps.com.

See Also

val_cname,val_psyo, val_var

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
## Not run: \dontrun{
data(psyo)

# Test t_id
t1 <- psyo
t_id <- "id"
e <- val_cname(t1, t_id, size = 15, type = "numeric"); if (e != "") {stop(e)}

# Be aware that id column is saved as "factor" and therefore mode() returns
# numeric.

t2 <- psyo
t_id <- 1
e <- val_cname(t2, t_id); if (e != "") {stop(e)}

t3 <- psyo
t_id <- "id"
e <- val_cname(t3, t_id, size = 15, type = "character"); if (e != "") {stop(e)}

t4 <- psyo
t_id <- "id"
e <- val_cname(t4, t_id, size = 20); if (e != "") {stop(e)}

t5 <- psyo
t_id <- "id"
e <- val_cname(t5, t_id, size = "20"); if (e != "") {stop(e)}
}
## End(Not run)

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