Description Usage Arguments Value Examples
View source: R/as-data-frame.R
Retrieve validation results as a data.frame
1 2 | ## S3 method for class 'tbl_validation'
as.data.frame(x, row.names = NULL, optional = FALSE, ...)
|
x |
|
row.names |
ignored |
optional |
ignored |
... |
ignored |
data.frame
, result of the query on the database.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | # create a table in a database
income <- data.frame(id = letters[1:2], age=c(12,35), salary = c(1000,NA))
con <- dbplyr::src_memdb()
tbl_income <- dplyr::copy_to(con, income, overwrite=TRUE)
# Let's define a rule set and confront the table with it:
rules <- validator( is_adult = age >= 18
, has_income = salary > 0
, mean_age = mean(age,na.rm=TRUE) > 20
)
# and confront!
cf <- confront(tbl_income, rules, key = "id")
as.data.frame(cf)
# and now with a sparse result:
cf <- confront(tbl_income, rules, key = "id", sparse=TRUE)
as.data.frame(cf)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.