Dear Folks--
All this seems to me to behave the way you expect, recognising that column b
is a factor:
> AA <- data.frame(a=3:4, b=c('x', 'y'))
> AA[1,]
  a b
1 3 x
> as.numeric(AA[1,])
[1] 3 1
> AA[,2]
[1] x y
Levels: x y
> as.numeric(AA[,2])
[1] 1 2
> as.character(AA[,2])
[1] "x" "y"

But this seems to me to be wrong:
> as.character(AA[1,])
[1] "3" "1"

Shouldn't it be:
[1] "3" "x"
to be consistant with the normal pattern of coercing factors to character
values?
If it is a bug, is this the right place to post it?

sincerely, andrewH

--
View this message in context: 
http://r.789695.n4.nabble.com/re-coercing-data-frame-rows-to-character-Am-I-right-that-this-is-a-bug-tp3924449p3924449.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
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