Description Usage Arguments Details Examples
View source: R/Utils_Methods.R
A generic checking utility. This will need various presets of values for the various possible columns, and may have its own wrappers for each.
1 | check_values(x, expected.values, categorical = FALSE)
|
x |
vector of values, |
expected.values |
set of valid values if |
categorical |
logical. Does the value represent categories? Default |
make sure values in a column are as expected
1 2 3 4 5 6 7 8 9 10 11 | expected.values <- c(0,1)
# can be a check on probabilities, perhaps they're in logit and we dont' realize it?
x <- runif(10)
x <- log(x/(1-x))
#out <- try(check_values(x,c(0,1),categorical = FALSE))
# de facto unit test..
#stopifnot(class(out) == "try-error")
# factors are checked against characters here.
y <- as.factor(c("a","b","c"))
check_values(y,letters,categorical = TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.