[R] Skipping rows and columns in large matrix
Silvia Lomascolo
slomascolo at zoo.ufl.edu
Tue May 8 23:25:24 CEST 2007
I work on Windows, R version 2.4.1
I need to leave out many rows and columns when reading a matrix. The 'skip'
commands in read.table, seem to be just for skipping rows, if I understand
well, but I need to skip many columns as well. I tried something very simple
and left one row and one column out, but I don't know how to do it for many
rows and columns at a time.
Example:
zzz # euclidean distances matrix
X1 X2 X3 X4 X5
X1 0 11 12 1 15
X2 11 0 5 12 3
X3 12 5 0 8 4
X4 1 12 8 0 16
X5 15 3 4 16 0
skip.data = zzz [-3, -3] # gives me the same matrix without row 3 and
column 3... how can I tell R to skip more than one row and column? Columns
and rows to be left out are not contiguous The matrix I'm using is fairly
large (335x335), so excel won't read the whole thing, and it's not a
fixed-width txt file, so I cannot use read.fwf. I also don't have access to
Unix, as was suggested to other users to solve this problem.
--
View this message in context: http://www.nabble.com/Skipping-rows-and-columns-in-large-matrix-tf3712332.html#a10384400
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list