R-alpha: list assignment

Robert Gentleman rgentlem@stat.auckland.ac.nz
Fri, 25 Apr 1997 13:12:36 +1200 (NZST)


Peter,
  They don't work on purpose. Basically this is the same problem as indexing
beyond the end of an array. In almost all cases it is an error.
To add a variable with a specific name to a data frame how about

x (the dataframe)
var1 the variable
name1 the name

 x<-cbind(x,var1)
 names(x)[ncol(x)]<-name1


robert
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-