Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

set_names

Set Names


Description

Sets the names (or colnames) of x to nm. If nm is a function, it is used to transform the already existing names of x.

Usage

set_names(x, nm = x, ...)

set_col_names(x, nm, ...)

Arguments

x

(any.)
Object to set names for.

nm

(character() | function())
New names, or a function which transforms already existing names.

...

(any)
Passed down to nm if nm is a function.

Value

x with updated names.

Examples

x = letters[1:3]

# name x with itself:
x = set_names(x)
print(x)

# convert names to uppercase
x = set_names(x, toupper)
print(x)

mlr3misc

Helper Functions for 'mlr3'

v0.10.0
LGPL-3
Authors
Michel Lang [cre, aut] (<https://orcid.org/0000-0001-9754-0393>), Patrick Schratz [aut] (<https://orcid.org/0000-0003-0748-6624>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.