[R] charactor matrix convert to numeric matrix

Yuan Jian
Wed, 02 Jun 2010 12:15:25 -0000

Hello R experts,
can you tell me a simple way to convert a charactor matrix to numeric matrix?
if I use as.numeric, the matrix is converted to a vector.

a<-cbind(c("23","54","65"),c("1","2","3"))
a
     [,1] [,2]
[1,] "23" "1"
[2,] "54" "2"
[3,] "65" "3"

 as.numeric(a)
[1] 23 54 65  1  2  3

thanks
Jian






	[[alternative HTML version deleted]]