[R] data.frame to character

2005-06-10 Thread Muhammad Subianto
Hi, Excuse me for this simple question. How to convert as.data.frame to as.character? ?data.frame L3 - LETTERS[1:3] L10 - LETTERS[1:10] d - data.frame(cbind(x=c(XYZ), y=L10), fac=sample(L3, 10, repl=TRUE)) d x y fac 1 XYZ A A 2 XYZ B A 3 XYZ C A 4 XYZ D A 5 XYZ E

Re: [R] data.frame to character

2005-06-10 Thread Liaw, Andy
Is this what you want? d[] - lapply(d, as.character) str(d) `data.frame': 10 obs. of 3 variables: $ x : chr XYZ XYZ XYZ XYZ ... $ y : chr A B C D ... $ fac: chr B A C B ... Andy From: Muhammad Subianto Hi, Excuse me for this simple question. How to convert as.data.frame to

Re: [R] data.frame to character

2005-06-10 Thread Gabor Grothendieck
On 6/10/05, Muhammad Subianto [EMAIL PROTECTED] wrote: Hi, Excuse me for this simple question. How to convert as.data.frame to as.character? ?data.frame L3 - LETTERS[1:3] L10 - LETTERS[1:10] d - data.frame(cbind(x=c(XYZ), y=L10), fac=sample(L3, 10, repl=TRUE)) d[] -

Re: [R] data.frame to character - thanks

2005-06-10 Thread Muhammad Subianto
Dear all, Thank you very much for your help. I would like to thank Andy Liaw and Gabor Grothendieck for their fast help. Regards, Muhammad Subianto On this day 6/10/2005 2:30 PM, Liaw, Andy wrote: Is this what you want? d[] - lapply(d, as.character) str(d) `data.frame': 10 obs. of

Re: [R] data.frame to character - thanks

2005-06-10 Thread Gabor Grothendieck
Here is one minor improvement -- it does not overwrite the input: replace(d,,as.matrix(d)) On 6/10/05, Muhammad Subianto [EMAIL PROTECTED] wrote: Dear all, Thank you very much for your help. I would like to thank Andy Liaw and Gabor Grothendieck for their fast help. Regards, Muhammad