Skip to content
Prev 127764 / 398500 Next

Odp: convert factor dataframe into numeric matrix

Hi

r-help-bounces at r-project.org napsal dne 24.10.2007 14:51:10:
to
but
You missed to provide several information, mainly some example.

1.      How did you get nonumeric data frame? If it is by transfer from 
Excel or something like that, you definitelly shall look at raw data as 
there is some mismatch. R tries to keep numeric as numeric but converts 
character to factor.
2.      Are the values numeric? I presume that yes. So you can use e.g. 
sapply

 sapply(dat, function(x) as.numeric(as.character(x)))

Regards
Petr
http://www.R-project.org/posting-guide.html