[R] charactor matrix convert to numeric matrix

2010-06-02 Thread Yuan Jian
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

Re: [R] charactor matrix convert to numeric matrix

2010-06-02 Thread jim holtman
try this: a-cbind(c(23,54,65),c(1,2,3)) a [,1] [,2] [1,] 23 1 [2,] 54 2 [3,] 65 3 mode(a) - 'numeric' a [,1] [,2] [1,] 231 [2,] 542 [3,] 653 On Wed, Jun 2, 2010 at 8:15 AM, Yuan Jian jayuan2...@yahoo.com wrote: Hello R experts, can you tell me a simple way to

Re: [R] charactor matrix convert to numeric matrix

2010-06-02 Thread Jorge Ivan Velez
Hi Jian, Try matrix(as.numeric(a), ncol = 2) HTH, Jorge On Wed, Jun 2, 2010 at 8:15 AM, Yuan Jian wrote: 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.