Re: [R] Reading an upper triangular matrix

2003-11-11 Thread Prof Brian Ripley
On Tue, 11 Nov 2003, Prof Brian Ripley wrote: > You supplied "what" as a list of length 2, which is not what you intended. > I presume you read every other item on the first line. > > Try list("a", rep(list(0), 22-i)) Sorry, that got mangled when my cable modem went down. I tested c(list("a"),

Re: [R] Reading an upper triangular matrix

2003-11-11 Thread Prof Brian Ripley
You supplied "what" as a list of length 2, which is not what you intended. I presume you read every other item on the first line. Try list("a", rep(list(0), 22-i)) I would have read the whole of the matrix as a character vector, removed the items corresponding to the labels, converted to numeric.

Re: [R] Reading an upper triangular matrix

2003-11-10 Thread Thomas W Blackwell
Kjetil - Frankly, your file would be much, much easier to read if it didn't have a row name at the beginning of each line. Any chance you can edit it to remove those ? Then, I think you could read in the numeric data with just one call to scan: mat <- matrix(0, 21, 21) mat[row(mat) >= col(mat

[R] Reading an upper triangular matrix

2003-11-10 Thread kjetil
Hola! I have data in the form of a symmetric distance matrix, in the file I have recorded only the upper triangular part, with diagonal. The matrix is 21x21, and the file have row and col names, and some other information. I am trying to read with the following code (I tried many variations on