repair_names {tibble}R Documentation

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

repair_names(list(3, 4, 5)) # works for lists, too
repair_names(mtcars) # a no-op
tbl <- as_data_frame(structure(list(3, 4, 5), class = "data.frame"))
repair_names(tbl)

[Package tibble version 1.0 Index]