Dear useRs, i had a matrix with 31 rows and 444 columns and i wanted to extract every 37th column of that matrix starting from 1. more precisely i wanted to select columns 1, 38,75, 112 and so on. then doing the same by starting from column number 2(2,39,76,113.......). i was advised to use >x[c(TRUE, rep(FALSE, 36)),] i works if it is start from first column but as i am very new to R i wanted to know what to do to make it work if i want to start column selection from column 2 and then from column 3 and so on. sorry for bothering you once again.. regards eliza
> From: [email protected] > To: [email protected] > Date: Tue, 18 Sep 2012 15:06:18 +0000 > CC: [email protected] > Subject: Re: [R] extracting column and regular interval in R > > > thnkyou very much micheal. > i worked!!! > regards > eliza > > > > From: [email protected] > > Date: Tue, 18 Sep 2012 15:58:31 +0100 > > Subject: Re: [R] extracting column and regular interval in R > > To: [email protected] > > CC: [email protected] > > > > x[c(TRUE, rep(FALSE, 36)),] > > > > and let recycling work its magic! > > > > To concretize: > > > > x <- 1:100 > > > > x[c(TRUE, rep(FALSE, 4))] > > > > Cheers, > > Michael > > > > On Tue, Sep 18, 2012 at 3:55 PM, eliza botto <[email protected]> > > wrote: > > > > > > Dear R users, > > > i have a matrix with 31 rows and 444 columns and i want to extract every > > > 37th column of that matrix starting from 1. more precisely i want to > > > select columns 1, 38,75, 112 and so on. then doing the same by starting > > > from column number 2(2,39,76,113.......). > > > i know that there is a manual way of doing it but i wanted to make it > > > more quickly as i have fairly large data to dealth with. > > > > > > thanks in advance > > > eliza > > > [[alternative HTML version deleted]] > > > > > > ______________________________________________ > > > [email protected] 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. > > [[alternative HTML version deleted]] > > ______________________________________________ > [email protected] 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. [[alternative HTML version deleted]] ______________________________________________ [email protected] 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.

