check_key {cubble}R Documentation

Check on key when create cubble from two components (spatial/temporal)

Description

When creating a cubble from separate spatial and temporal component, make_cubble() will informed users about potential disagreement of the key values in the two datasets (some sites appear in one table but not the other). This function summarises the key values into those match, potentially can be matched, and can't be matched.

Usage

check_key(spatial, temporal, by = NULL)

Arguments

spatial

a tibble object or an sf object, the spatial component containing the key and coords variable (coords can be automatically created from an sf object if not supplied).

temporal

a tibble object or a tsibble object, the temporal component containing the key and index variable.

by

in the syntax of the by argument in dplyr::left_join(), used in make_cubble() when the key variable has different names in the spatial and temporal data.

Value

a list with three elements: 1) paired: a tibble of paired ID from spatial and temporal data, 2) potential_pairs: a tibble of pairs that could potentially match from both datasets, 3) others: other key values that can't be matched in a list: others$temporal and others$spatial

Examples

check_key(stations, meteo)

# make_cubble() will prompt to use check_key if there are key mis-match:
make_cubble(spatial = lga, temporal = covid, by = c("lga_name_2018" = "lga"))
check_key(lga, covid, by = c("lga_name_2018" = "lga"))

[Package cubble version 0.3.0 Index]