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

names2

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

(any)
Object.

missing_val

(atomic(1))
Value to set for missing names. Default is NA_character_.

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 = "")

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.