values: Value-Domains For Columns in Table Designs

Description Usage Arguments Value Examples

View source: R/values.R

Description

Value-Domains For Columns in Table Designs

Usage

1
values(domain, value)

Arguments

domain

name or id of the domain.

value

values that the domains can take

Value

a data.frame of class "tabde_values"

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
vals <- values(
  c("letters", "letters", "numbers"),
  c("a", "b", 2)
)

td <- tabde(
  col_name   = c("Alpha", "Num"),
  col_type   = c("character", "numeric"),
  col_domain = c("letters", "numbers")
)

df <- data.frame(
  Alpha = c("a", "b", "c"),
  Num   = c(2, 2, 3),
  stringsAsFactors = FALSE
)


# Fails because df contains values not in `vals`:
matches_tabde(df, td, values = vals)

# Ok:
matches_tabde(df[1:2, ], td, values = vals)

# domains are only checked if `values` is passed to matches_tabde
matches_tabde(df, td)

s-fleck/tabde documentation built on April 4, 2021, 10:11 p.m.