Description Usage Arguments Details Value Examples
View source: R/tf_check.R View source: R/tf_check_2.R
Check transformation values
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | tf_check(data, expr, key, ...)
## Default S3 method:
tf_check(data, expr, key, ...)
## S3 method for class 'atomic'
tf_check(data, expr, key, .all)
## S3 method for class 'data.frame'
tf_check(data, expr, key = TRUE, ...)
## S3 method for class 'tf_try'
tf_check(data, expr, key = TRUE, ...)
tf_pass(...)
## S3 method for class 'tf_check'
format(x, all = FALSE)
|
data |
table of data to function as environment for |
expr |
expression to evaluate |
... |
arguments to |
.all |
logical whether to display all the observation or just the failed transformations. (Default: 'FALSEā) |
format
formats a tf_check object; argument all=TRUE
will show all
observations rather than those that fail'
A data.table with the result of the expression followed by the names used from the columns
unexpected where one or more of the args are na
any missing
failures : no missing args,
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 |
# Tables:
data(iris)
setDT(iris)
iris[ , Species := Species %>% as.character() ]
iris %>% tf_check( Species %>% as.character() )
iris %>% tf_check( Species %>% as.numeric() )
iris %>% setkey( Sepal.Length )
iris %>% tf_check( Species %>% as.character(), .all=TRUE )
iris %>% tf_pass( Species %>% as.character() )
iris %>% tf_pass( Species %>% as.numeric() )
x <- c(-2:2, NA) %>%
tf_try( sqrt ) %>%
tf_try( function(x) sqrt(x+1) )
tf_check(x)
Format:
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.