Hello R users I was trying to find a less annoying way of naming vectors than: x<-1:10 names(x)[1:length(x)]<-"A" So I tried: x<-1:10 names(x)<-"A" #but this gave only the first element named (as described in the help files) and x<-1:10 names(x)[]<-"A" #but this gave all elements named NA The curious thing with this last option is that if the same line is ran a second time, now the vector gets the name "A" for all elements, which is what is desired names(x)[]<-"A" I'm guessing the first time the names attribute is created and the second time values are given to this attribute. But shouldn't we expect the elements to be all named on the first try with the given value? Cheers Francois [[alternative HTML version deleted]]
______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.