Re: [R] Empty data frame does not maintain column type

2010-10-06 Thread N David Brown
Thanks to all three of you for responding. Brilliant answer there, David - using the options() function as exemplified to set stringsAsFactors=FALSE universally solved the issue. Much appreciated, guys. On 6 October 2010 18:27, David Winsemius wrote: > > On Oct 6, 2010, at 1:00 PM, N

[R] Empty data frame does not maintain column type

2010-10-06 Thread N David Brown
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