Does anyone know why a data frame created with empty character columns
converts them to integer columns?

> df<-data.frame(a=character(0),b=character(0))
> df<-rbind(df,c("a","a"))
> typeof(df[1,1])
[1] "integer"

AsIs doesn't help:

> df<-data.frame(a=I(character(0)),b=I(character(0)))
> df<-rbind(df,I(c("a","a")))
> typeof(df[1,1])
[1] "integer"

Any suggestions on how to overcome this would be appreciated.

Best wishes,

David

______________________________________________
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.

Reply via email to