[R] factor to numeric in data.frame

2005-04-02 Thread Heinz Tuechler
Dear All, Assume I have a data.frame that contains also factors and I would like to get another data.frame containing the factors as numeric vectors, to apply functions like sapply(..., median) on them. I read the warning concerning as.numeric or unclass, but in my case this makes sense, because

Re: [R] factor to numeric in data.frame

2005-04-02 Thread Gabor Grothendieck
Try this: data.matrix(df.f12) On Apr 2, 2005 6:01 AM, Heinz Tuechler [EMAIL PROTECTED] wrote: Dear All, Assume I have a data.frame that contains also factors and I would like to get another data.frame containing the factors as numeric vectors, to apply functions like sapply(..., median) on

Re: [R] factor to numeric in data.frame

2005-04-02 Thread Prof Brian Ripley
On Sat, 2 Apr 2005, Heinz Tuechler wrote: Dear All, Assume I have a data.frame that contains also factors and I would like to get another data.frame containing the factors as numeric vectors, to apply functions like sapply(..., median) on them. I read the warning concerning as.numeric or unclass,

Re: [R] factor to numeric in data.frame

2005-04-02 Thread Heinz Tuechler
At 07:15 02.04.2005 -0500, Gabor Grothendieck wrote: Try this: data.matrix(df.f12) Perfect! This is exactly what I needed. Many thanks, Heinz Tüchler On Apr 2, 2005 6:01 AM, Heinz Tuechler [EMAIL PROTECTED] wrote: Dear All, Assume I have a data.frame that contains also factors and I would

Re: [R] factor to numeric in data.frame

2005-04-02 Thread Heinz Tuechler
At 14:26 02.04.2005 +0100, Prof Brian Ripley wrote: On Sat, 2 Apr 2005, Heinz Tuechler wrote: Dear All, Assume I have a data.frame that contains also factors and I would like to get another data.frame containing the factors as numeric vectors, to apply functions like sapply(..., median) on