[R] dataframes without data

Wolfgang Koller koller2 at fgr.wu-wien.ac.at
Thu Nov 18 11:25:21 CET 1999


Hi!

There seems to be some inconsistency in the following behaviour:

> MYDATA <- data.frame(b=c("A","B","C"),x=c(1,2,3))
> MYDATA
  b x
1 A 1
2 B 2
3 C 3
> MYDATAnew <- MYDATA[0:0,]
> MYDATAnew
[1] b x
<0 rows> (or 0-length row.names)
> MYDATAnew <- rbind(MYDATA[0:0,],MYDATA)
> MYDATAnew
  b x
1 1 1
2 2 2
3 3 3

Does R forget the type of the columns of a data.frame when the 
data.frame contains no data??

Wolfgang Koller


----------------------------------------------------------
Wolfgang Koller,  koller2 at fgr.wu-wien.ac.at
Forschungsinstitut fuer Europafragen
Wirtschaftsuniversitaet Wien
Althanstrasse 39-45, 1090 Wien, Austria
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help 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-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list