set_names_idx: Set names in a vector with sequential numbering

Description Usage Arguments Value See Also Examples

View source: R/set_names.R

Description

Set the names in vector with a pattern based on sequential numbering, e.g. Var1, Var2, ...

Usage

1
set_names_idx(x, .f = "%d", ...)

Arguments

x

An object to be named

.f

A character vector or function. If .f is a function, then its first argument will be the index numbers of the names. If .f is a character, then it should be a format string for sprintf pattern.

...

Arguments passed to .f.

Value

The object x with its names (colnames, rownames) set.

See Also

setNames, set_names, set_colnames, set_colnames.

Examples

1
2
3
set_names_idx(1:5)
set_names_idx(1:5, "X%d")
set_names_idx(1:5, function(i) stringr::str_c("Var_", i))

jrnold/rubbish documentation built on May 20, 2019, 2:05 a.m.