tibble (version 1.2)

repair_names: Repair object names.

Description

repair_names ensures its input has non-missing and unique names (duplicated names get a numeric suffix). Valid names are left as is.

Usage

repair_names(x, prefix = "V", sep = "")

Arguments

x
A named vector.
prefix
A string, the prefix to use for new column names.
sep
A string inserted between the column name and de-duplicating number.

Value

x with valid names.

Examples

Run this code
repair_names(list(3, 4, 5)) # works for lists, too
repair_names(mtcars) # a no-op
tbl <- as_tibble(structure(list(3, 4, 5), class = "data.frame"),
                 validate = FALSE)
repair_names(tbl)

Run the code above in your browser using DataLab