The following work if y is an ordinary matrix but not a dataframe: tt <- NULL y <- data.frame(1:20,1:20) rbind(tt,y) gives "incompatible types" error (if the dataframe contains only factor variables, it gives warnings but works) if I initialize instead with tt <- list() it gives a "missing value where logical needed" error. Jim -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
>>>>> jlindsey writes:> The following work if y is an ordinary matrix but not a dataframe: > tt <- NULL > y <- data.frame(1:20,1:20) > rbind(tt,y)> gives "incompatible types" error (if the dataframe contains only factor > variables, it gives warnings but works)> if I initialize instead with> tt <- list()> it gives a "missing value where logical needed" error.I've added a line in rbind.data.frame() which removes all length 0 arguments. This solves the problems you describe and passes make check, but I am not sure if we really want it ... -k -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
>>>>> "KH" == Kurt Hornik <hornik@ci.tuwien.ac.at> writes:>>>>> jlindsey writes:>> The following work if y is an ordinary matrix but not a dataframe: >> tt <- NULL y <- data.frame(1:20,1:20) rbind(tt,y) >> gives "incompatible types" error (if the dataframe contains only >> factor variables, it gives warnings but works) >> if I initialize instead with >> tt <- list() >> it gives a "missing value where logical needed" error. KH> I've added a line in rbind.data.frame() which removes all length 0 KH> arguments. This solves the problems you describe and passes make KH> check, but I am not sure if we really want it ... I think I agree that we don't want it! or does the following still work after your fix?> m0 <- matrix(0,0,3,dimnames=list(NULL,letters[1:3])) > d0 <- as.data.frame(m0) > rbind(m0,1)a b c [1,] 1 1 1> str(d0)`data.frame': 0 obs. of 3 variables: $ a: num $ b: num $ c: num> rbind(d0,1)a b c 1 1 1 1>Martin -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._