On Apr 8, 2010, at 7:39 AM, Lee William wrote:

Hello! All,

I am working on 10000x1000 matrix say 'mat' and i want to subset this matrix in a fashion that in new matrix i get columns 2,3,9,10,16,17,23,24.......so on. That is pair of columns after every interval of 7. I tried following but
i got an error which is obvious.

a <- mat[ , sort( c(seq(2, 1000, by=7), 1 +seq(2, 1000, by=7)))]


dim(mat)
[1] 10000   10

a=mat[,c(seq(c(2,3),ncol(mat),7))]
Warning messages:
1: In if (n < 0L) stop("wrong sign in 'by' argument") :
 the condition has length > 1 and only the first element will be used
2: In if (n > .Machine$integer.max) stop("'by' argument is much too small")
:
 the condition has length > 1 and only the first element will be used
3: In if (dd < 100 * .Machine$double.eps) return(from) :
 the condition has length > 1 and only the first element will be used
4: In 0L:n : numerical expression has 2 elements: only the first used

Is there any other way to do it?? Please, help!

regards
Lee

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org 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.

David Winsemius, MD
West Hartford, CT

______________________________________________
R-help@r-project.org 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.

Reply via email to