names2 {BBmisc} | R Documentation |
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
.
names2(x, missing.val = NA_character_)
x |
[ |
missing.val |
[ |
[character
]: vector of the same length as x
.
x = 1:3
names(x)
## NULL
names2(x)
## [1] NA NA NA
names(x[1:2]) = letters[1:2]
names(x)
## NULL
names2(x)
## [1] NA NA NA