View source: R/discover_keys.r
| discover_keys | R Documentation |
Finds all the keys for a data frame, ignoring duplicate rows.
discover_keys(
df,
keep_rownames = FALSE,
digits = getOption("digits"),
exclude = character(),
exclude_class = character(),
size_limit = ncol(df),
progress = FALSE,
progress_file = "",
skip_bijections = FALSE
)
df |
a data.frame, the relation to evaluate. |
keep_rownames |
a logical or a string, indicating whether to include the row names as a column. If a string is given, it is used as the name for the column, otherwise the column is named "row". Like with the other column names, the function returns an error if this results in duplicate column names. Set to FALSE by default. |
digits |
a positive integer, indicating how many significant digits are
to be used for numeric and complex variables. A value of |
exclude |
a character vector, containing names of attributes to not
consider as members of keys. If names are given that aren't present in
|
exclude_class |
a character vector, indicating classes of attributes to not consider as members of keys. Attributes are excluded if they inherit from any given class. |
size_limit |
an integer, indicating the largest key size to search for. By default, this is large enough to allow all attributes. |
progress |
a logical, for whether to display progress to the user during
dependency search in |
progress_file |
a scalar character or a connection. If |
skip_bijections |
a logical, indicating whether to skip some key
searches that are made redundant by discovered bijections between
attributes. This can significantly speed up the search. See Details in the
documentation for |
Column names for df must be unique.
The search algorithm was adapted from the FDHits algorithm used for
discover. It is likely to be an implementation of the HPIValid
algorithm, although it wasn't used directly as a source. It has the same
implications with respect to floating-point variables.
A list of character vectors, containing the discovered keys. The
attributes within each key are given in the same order as in df.
FDHits: Bleifuss T., Papenbrock T., Bläsius T., Schirneck M, Naumann F. (2024) Discovering Functional Dependencies through Hitting Set Enumeration. Proc. ACM Manag. Data, 2, 1, 43:1–24.
HPIValid: Birnick J., Bläsius T., Friedrich T., Naumann F., Papenbrock T., Schirneck M. (2020) Hitting set enumeration with partial information for unique column combination discovery. Proceedings of the VLDB Endowment, 13, 12, 2270–2283.
# simple example
discover_keys(ChickWeight)
# example with spurious key
discover_keys(CO2)
# exclude attributes that can't be determinants.
# in this case, the numeric attributes are now
# not determined by anything, because of repeat measurements
# with no variable to mark them as such.
discover_keys(CO2, exclude_class = "numeric")
# exclude keys spuriously using the measurement attribute
discover_keys(CO2, exclude = "uptake")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.