[Rd] Inconsistency when naming a vector

Hadley Wickham h.wickham at gmail.com
Mon Apr 27 13:48:59 CEST 2015


Sometimes the absence of a name is maked by an NA:

x <- 1:2
names(x)[[1]] <- "a"
names(x)
# [1] "a" NA

Whereas other times its

y <- c(a = 1, 2)
names(y)
# [1] "a" ""

Is this deliberate? The help for names() is a bit murky, but an
example shows the NA behaviour.

Hadley

-- 
http://had.co.nz/



More information about the R-devel mailing list