names2 {mlr3misc} | R Documentation |
A Type-Stable names() Replacement
Description
A simple wrapper around base::names()
.
Returns a character vector even if no names attribute is set.
Values NA
and ""
are treated as missing and replaced with the value provided in missing_val
.
Usage
names2(x, missing_val = NA_character_)
Arguments
x |
( |
missing_val |
( |
Value
(character(length(x))
).
Examples
x = 1:3
names(x)
names2(x)
names(x)[1:2] = letters[1:2]
names(x)
names2(x, missing_val = "")
[Package mlr3misc version 0.15.1 Index]