[R] Skipping rows and columns in large matrix
Gabor Grothendieck
ggrothendieck at gmail.com
Wed May 9 03:13:19 CEST 2007
Columns that correspond to NULLs in the colClasses arg of read.table
are ignored. ?read.table
On 5/8/07, Silvia Lomascolo <slomascolo at zoo.ufl.edu> wrote:
>
> 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.
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
More information about the R-help
mailing list