nuts_test_multiple_versions {nuts}R Documentation

Helper function to test for multiple versions

Description

nuts_test_multiple_versions is called from either nuts_convert_version or nuts_aggregate to selects the most frequent version within groups or throw an error.

Usage

nuts_test_multiple_versions(group_vars, multiple_versions, data_versions, data)

Arguments

group_vars

Variable name(s) for classification within groups. Always computes overlap within country. NULL by default.

multiple_versions

By default equal to 'error', when providing multiple NUTS versions within groups.

data_versions

Data versions

data

A nuts.classified object returned by nuts_classify().

Value

A tibble containing NUTS codes, the potential number of rows dropped and a message with the results of the test.

Examples

library(dplyr)
df <- manure %>%
  filter(nchar(geo) == 5) %>%
  select(geo, indic_ag, values) %>%
  distinct(geo,  .keep_all = TRUE) %>%
  nuts_classify(nuts_code = "geo",
                group_vars = "indic_ag",
                data = .)

nuts_test_multiple_versions(group_vars = "indic_ag",
                            multiple_versions = "most_frequent",
                            data_versions = df$versions_data,
                            data = df$data)


[Package nuts version 1.0.0 Index]