Profiles every row of a DBTable_v9 with profile_query(). The table
supplies the query, the field types and the keys.
Arguments
- table
A DBTable_v9.
- columns
The sensitivity of each column, as in
profile_query().- ...
Other arguments to
profile_query(). Do not giveconnection,sql,field_typesorkeys.
Value
A csdb_profile, as profile_query() returns it. The query is
dbplyr::sql_render(table$tbl()).
See also
Other profile functions:
profile_data(),
profile_query(),
read_profile(),
write_profile()
Examples
tab <- DBTable_v9$new(
dbconfig = list(driver = "SQLite", db = tempfile(fileext = ".sqlite")),
table_name = "visits",
field_types = c(id = "INTEGER", sex = "TEXT"),
keys = "id",
validator_field_types = validator_field_types_blank,
validator_field_contents = validator_field_contents_blank
)
tab$create_table()
#> Creating table visits
#> NULL
tab$insert_data(data.table::data.table(
id = 1:12,
sex = rep(c("female", "male"), 6)
))
p <- profile_table(tab, columns = c(sex = "full"))
p$columns$sex
#> $type
#> [1] "TEXT"
#>
#> $sensitivity
#> [1] "full"
#>
#> $missing_share
#> [1] 0
#>
#> $levels
#> [1] "female" "male"
#>
#> $n
#> [1] 6 6
#>
tab$dbconnection$disconnect()
