Get names of columns that form a (unique) key associated with an object
Source:R/key_colnames.R
key_colnames.RdThis is entirely based on metadata and arguments passed; there are no explicit checks that the key actually is unique in any associated data structures.
Usage
key_colnames(x, ..., exclude = character())
# S3 method for class 'data.frame'
key_colnames(x, ..., geo_keys, other_keys, time_keys, exclude = character())
# S3 method for class 'epi_df'
key_colnames(
x,
...,
geo_keys = "geo_value",
other_keys = attr(x, "metadata")$other_keys,
time_keys = "time_value",
exclude = character()
)
# S3 method for class 'tbl_ts'
key_colnames(x, ..., exclude = character())
# S3 method for class 'epi_archive'
key_colnames(x, ..., exclude = character())Arguments
- x
an object, often a data frame or something similar.
{epiprocess}includes implementations forepi_dfs,epi_archives,tsibble::tsibbles, and other data frames (includingtibble::tibbles); other packages, like{epipredict}, can add more.- ...
additional arguments passed on to methods
- exclude
an optional character vector of key column names to exclude from the result
- geo_keys, other_keys, time_keys
character vectors, sometimes optional; which variables (if any) should be considered as part of a unique key/identifier for data in
x, dealing respectively with the associated geographical region, demographic/strain/other information needed in addition to the geographical region to identify individual time series inx, and time interval during which associated events occurred.Mandatory if
xis a regulardata.frameortibble. Optional ifxis anepi_df; the defaults are"geo_value", theepi_df'sother_keysmetadata, and"time_value", respectively; if you provide these manually, they must match the defaults. (This behavior is to enable consistent and sane results when you can't guarantee whetherxis anepi_dfor just atibble/data.frame. You don't need to use it if you know thatxis definitely anepi_df.) Not accepted whenxis atsibbleor anepi_archive.