Full_Name: Sébastien Villemot
Version: 2.5.1
OS: Debian GNU/Linux (Testing aka "Lenny")
Submission from: (NULL) (193.51.127.120)


Here is the transcript of a R session under version 2.5.1:

> x <- data.frame(a = I(character(0)))
> typeof(x$a)
[1] "character"
> x <- rbind(x, list(a = "foo"))
> typeof(x$a)
[1] "integer"

The column "a" has been converted from character to factor.

This was not happening under version 2.4.0 Patched (2006-11-25 r39997):
> x <- data.frame(a = I(character(0)))
> typeof(x$a)
[1] "character"
> x <- rbind(x, list(a = "foo"))
> typeof(x$a)
[1] "character"

Furthermore, the bug doesn't show up (in 2.5.1) if the data frame is initially
non-empty:
> x <- data.frame(a = I("bar"))
> typeof(x$a)
[1] "character"
> x <- rbind(x, list(a = "foo"))
> typeof(x$a)
[1] "character"

Best,

Sébastien Villemot

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to