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

names2

Replacement for names which always returns a vector.


Description

A simple wrapper for names. Returns a 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, probably named.

missing.val

[ANY]
Value to set for missing names. Default is NA_character_.

Value

[character]: vector of the same length as x.

Examples

x = 1:3
names(x)
names2(x)
names(x[1:2]) = letters[1:2]
names(x)
names2(x)

BBmisc

Miscellaneous Helper Functions for B. Bischl

v1.11
BSD_2_clause + file LICENSE
Authors
Bernd Bischl [aut, cre], Michel Lang [aut], Jakob Bossek [aut], Daniel Horn [aut], Jakob Richter [aut], Dirk Surmann [aut]
Initial release

We don't support your browser anymore

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