[R] A matrix problem
Bogaso
bogaso.christofer at gmail.com
Wed Sep 16 15:40:03 CEST 2009
Hi all,
I have following ch. matrix :
> mat
[,1] [,2] [,3] [,4]
[1,] "NA" "0.0671746073115122" "1.15281464953731"
"0.822277316923348"
[2,] "0.113184828073156" "-0.0133150789005112" "0.640912657072027"
"-0.0667317787225847"
[3,] "-1.40593584523871" "1.10755549414758" "0.493828059815449"
"-1.09233516877992"
[4,] "0.577643850085066" "1.10279525071026" "1.16725625310315"
"0.367724768195794"
[5,] "0.746100264271392" "-0.335556133578362" "NA"
"0.328559028366446"
Now I want to convert it to a numeric matrix. So I used following code :
> as.numeric(mat)
[1] NA 0.11318483 -1.40593585 0.57764385 0.74610026 0.06717461
-0.01331508 1.10755549 1.10279525 -0.33555613
[11] 1.15281465 0.64091266 0.49382806 1.16725625 NA 0.82227732
-0.06673178 -1.09233517 0.36772477 0.32855903
Warning message:
NAs introduced by coercion
What I noticed is that :
1. Original matrix converted to vector
2. A waring message is there.
I do not want such things to happen. Is there any direct way to convert my
original ch. matrix to a numeric matrix ?
Thanks
--
View this message in context: http://www.nabble.com/A-matrix-problem-tp25472583p25472583.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list