rwatkins@cornerstonelp.com
2003-May-16 21:32 UTC
[R] Newbie Matrix problem refined; Can't convert .csv data to matrix
Thanks to all for your previous help. I see now that my problem is converting my .csv file of data into a matrix. My example is a (3x3) matrix with a "header" row (that doesn't contain numerics). Thanks again for your time and gracious consideration.
Peter Dalgaard BSA
2003-May-16 22:34 UTC
[R] Newbie Matrix problem refined; Can't convert .csv data to matrix
<rwatkins at cornerstonelp.com> writes:> Thanks to all for your previous help. I see now that my problem is > converting my .csv file of data into a matrix. My example is a (3x3) matrix > with a "header" row (that doesn't contain numerics). > > Thanks again for your time and gracious consideration.I believe that was actually answered in at least one of the replies you already got, but to reiterate: Use as.matrix to coerce the data frame returned by read.csv to a matrix. As in:> A <- as.matrix(read.csv(stdin()))0: A,B,C 1: 1,2,3 2: 4,5,6 3: 7,8,9 4:> A%*%AA B C 1 30 36 42 2 66 81 96 3 102 126 150 -- O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907