[R] R help for a newby

tmed tmed at pacbell.net
Sun Nov 12 21:36:33 CET 2000


Hello,

    I'm trying to read a file that has ascci data in it. The format of the data
is in this order: test_number(integer) 4 double readings. Simple,ok, but for 
life of me I can't get R to put it into the internal format I need. What I want
to do is to make an array called dat and dim it 10000 rows by 5 columns.
That seems simple enough, I start out by:

dat <- array(0,dim=c(10000,5)) this looks ok. 
The next thing I did was to scan in the data.
dat <-scan("mydata-file",what=array(""),sep="\n").
I get the data into the dat array but its looks like a string.
ie "1000 34.5  34.7  35  35.6".
what I want is to make each of these data point go into 
the appropriate array index ie:
dat[1][1]   dat[1][2]  dat[1][3]   dat[1][4]   dat[1][5]
    1000     34.5        34.7         35           35.6

Any help would be greatly appreciated.

Thank you
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://stat.ethz.ch/pipermail/r-help/attachments/20001112/f981c178/attachment.html


More information about the R-help mailing list