Skip to contents

Counts records per outcome (the reason of removal, or KEPT), optionally split by a grouping column such as countryCode. Use it to see which tests remove records where, e.g. whether one country loses far more than others.

Usage

filter_report(x, by = NULL)

Arguments

x

An occ_filter object.

by

Optional column name to split by (e.g. "countryCode").

Value

A data.frame: with by = NULL, columns outcome and n (and, when the records have several data types, one column per data type); otherwise one row per group and one column per outcome.

Examples

# \donttest{
# the country check buffers the world map of countries (several seconds)
occ <- data.frame(decimalLongitude = c(10.123, 10.123, 0, 11.456),
                  decimalLatitude = c(46.123, 46.123, 0, 46.789),
                  countryCode = c("AT", "AT", "IT", "IT"))
res <- filter_occurrences(occ, filter_settings(cc_tests = "zeros"),
                          verbose = FALSE)
#> Warning: [vect] guessed crs
filter_report(res)
#>                  outcome n
#> 1                   KEPT 0
#> 2              duplicate 1
#> 3        coarse_decimals 1
#> 4       country_mismatch 1
#> 5 small_isolated_cluster 1
filter_report(res, by = "countryCode")
#>   countryCode KEPT duplicate coarse_decimals country_mismatch
#> 1          AT    0         1               0                1
#> 2          IT    0         0               1                0
#>   small_isolated_cluster
#> 1                      0
#> 2                      1
# }