Re: [Rd] Unexpected result of as.character() and unlist() applied to a data frame

2007-03-27 Thread Herve Pages
Liaw, Andy wrote: > Given that the behavior is exactly as I expected it be, I would call > that "feature" (and IMHO not a very special one). The two data frames > are just different (try str() on them: A in dd is factor, while A in > dd2 is character), so I don't know why you'd expect unlist() on

Re: [Rd] Unexpected result of as.character() and unlist() applied to a data frame

2007-03-27 Thread Martin Maechler
> "Herve" == Herve Pages <[EMAIL PROTECTED]> > on Mon, 26 Mar 2007 20:48:33 -0700 writes: Herve> Hi, >> dd <- data.frame(A=c("b","c","a"), B=3:1) dd Herve> A B 1 b 3 2 c 2 3 a 1 >> unlist(dd) Herve> A1 A2 A3 B1 B2 B3 2 3 1 3 2 1 Herve> Someone else might get

Re: [Rd] Unexpected result of as.character() and unlist() applied to a data frame

2007-03-27 Thread Liaw, Andy
Given that the behavior is exactly as I expected it be, I would call that "feature" (and IMHO not a very special one). The two data frames are just different (try str() on them: A in dd is factor, while A in dd2 is character), so I don't know why you'd expect unlist() on them to give you the same

[Rd] Unexpected result of as.character() and unlist() applied to a data frame

2007-03-26 Thread hpages
Hi, > dd <- data.frame(A=c("b","c","a"), B=3:1) > dd A B 1 b 3 2 c 2 3 a 1 > unlist(dd) A1 A2 A3 B1 B2 B3 2 3 1 3 2 1 Someone else might get something different. It all depends on the values of its 'stringsAsFactors' option: > dd2 <- data.frame(A=c("b","c","a"), B=3:1, stringsAsFactors=F