is_valid_primary_key {fritools} | R Documentation |
Is a Key a Valid Potential Primary Key for a data.frame
?
Description
I sometimes see tables with obscure structure so I try to guess their primary keys.
Usage
is_valid_primary_key(data, key, verbose = TRUE)
Arguments
data |
The |
key |
Character vector containing a subset of the columns names of
|
verbose |
Be verbose? |
Value
TRUE
, if key
is a valid primary key,
FALSE
otherwise.
See Also
Other bits and pieces:
golden_ratio()
,
is_difftime_less()
,
r_cmd_install()
,
str2num()
,
strip_off_attributes()
,
tapply()
,
throw()
Examples
is_valid_primary_key(mtcars, "qsec")
is_valid_primary_key(mtcars, "carb")
is_valid_primary_key(mtcars, c("qsec", "gear"))
is_valid_primary_key(mtcars, c("qsec", "carb"))
cars <- mtcars
cars$id <- seq_len(nrow(cars))
is_valid_primary_key(cars, "id")
[Package fritools version 4.3.0 Index]