tidy_names(), set_tidy_names(), and repair_names() were early efforts
to facilitate post hoc name repair in tibble, given that tibble() and
as_tibble() did not do this.
From tibble v2.0.0, the .name_repair argument gives direct access to three
specific levels of name repair: minimal, unique, and universal.
See vctrs::vec_as_names() for the implementation of the underlying logic.
tidy_names(name, syntactic = FALSE, quiet = FALSE)set_tidy_names(x, syntactic = FALSE, quiet = FALSE)
repair_names(x, prefix = "V", sep = "")
x with repaired names or a repaired version of name.
A names attribute, usually a character vector.
Should names be made syntactically valid? If FALSE, uses
same logic as .name_repair = "unique". If TRUE, uses same logic as
.name_repair = "universal".
Whether to suppress messages about name repair.
A vector.
A string, the prefix to use for new column names.
A string inserted between the column name and de-duplicating number.
These functions are superseded. The repair_names() logic
will also remain available in vctrs::vec_as_names_legacy().
tibble(..., `.name_repair = "unique"`)
## is preferred to
df <- tibble(...)
set_tidy_names(df, syntactic = FALSE)tibble(..., `.name_repair = "universal"`)
## is preferred to
df <- tibble(...)
set_tidy_names(df, syntactic = TRUE)