Re: [R] Seeking a more efficient way to read in a file

2008-01-02 Thread Charilaos Skiadas
On Jan 2, 2008, at 6:05 PM, Talbot Katz wrote: > Hi. > > I have a matrix stored in a large, tab-delimited flat file. The > first row contains column names. Because the matrix is symmetric, > the file has lower triangular format, so the second row contains > one number, the third row two nu

Re: [R] Seeking a more efficient way to read in a file

2008-01-02 Thread jim holtman
After you read in the first line, read the rest of the file with a single scan: rest <- scan(..., sep="\t", what=0, skip=1) index <- 1 # used to march through 'rest' for (i in 1:3000){ for (j in 1:i){ malt[i,j] <- rest[index] index <- index+1 } } There are probably faster

[R] Seeking a more efficient way to read in a file

2008-01-02 Thread Talbot Katz
Hi. I have a matrix stored in a large, tab-delimited flat file. The first row contains column names. Because the matrix is symmetric, the file has lower triangular format, so the second row contains one number, the third row two numbers, etc. In general, row k+1 contains k numbers; the mat