[R] convert factor dataframe into numeric matrix

Dimitris Rizopoulos dimitris.rizopoulos at med.kuleuven.be
Wed Oct 24 14:59:09 CEST 2007


look at ?data.matrix().

Best,
Dimitris

----
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven

Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http://med.kuleuven.be/biostat/
     http://www.student.kuleuven.be/~m0390867/dimitris.htm


----- Original Message ----- 
From: "sun" <flyhyena at yahoo.com.cn>
To: <r-help at stat.math.ethz.ch>
Sent: Wednesday, October 24, 2007 2:51 PM
Subject: [R] convert factor dataframe into numeric matrix


> Bear me if this is a naive question.
>
> I have a dataframe, all lists inside it are factors. When I use
> as.matrix(df) to convert, I get a character matrix while my 
> intention is to
> get numeric matrix. I can make the convertion  iteratively by each 
> list but
> I do think there is some more elegant way of doing this.
>
> please let me know if I missed somthing there.
>
> Thanks in advance.
>
> Sun
>
> ______________________________________________
> R-help at 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.
> 


Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm



More information about the R-help mailing list