R version 2.10.0 Under development (unstable) (2009-09-08 r49628) Here are two somewhat related questions.
First, when we attach a too short names vector to a vector the names vector is padded with NA's to the length of the main vector: E.g., > x<-1:3 > names(x)<-c("One","Two") > str(x) Named int [1:3] 1 2 3 - attr(*, "names")= chr [1:3] "One" "Two" NA I expected this length mismatch to cause an error, but I am biassed by my long usage of S and S+. Is the extension by padding with NA what is wanted? Second, if we extend a named vector with length<- the main vector is padded with NA's but the names are padded with empty strings. Should those be NA's? > x<-1:3 > names(x)<-c("One","Two") > length(x)<-4 > str(x) Named int [1:4] 1 2 3 NA - attr(*, "names")= chr [1:4] "One" "Two" NA "" The names "" and NA act alike in that subscript by either returns structure(NA, names=NA_character_), but they print differently > x One Two <NA> 1 2 3 NA Bill Dunlap TIBCO Software Inc - Spotfire Division wdunlap tibco.com ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel