repair_names: Repair object names.

Description Usage Arguments Value Examples

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

1
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

1
2
3
4
5
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)

Robertus100/tibble documentation built on May 9, 2019, 10:09 a.m.