Skip to content
Prev 227485 / 398500 Next

convert data.frame to matrix -> NA factor problem

Hi list,

I tried to convert a data.frame into a matrix using data.matrix.
Unfortunately my matrix contains missing values (NA) wherefore all columns
including NA's were changed into factors.

I thought that many people stumbled across that problem already wherefore
there must be a
simple solution. But it seems there isn't. I tried lapply, replace and other
things in combination
but still did not manage to convert my data.frame into a proper matrix with
numeric values.

Any advice?
Cheers