[R] Selecting variables from a data.frame
Laurent Gautier
laurent at cbs.dtu.dk
Tue Dec 31 03:39:02 CET 2002
On Tue, Dec 31, 2002 at 02:33:37AM +0100, Till Baumgaertel wrote:
>
> My question: which is the most elegant way to select the desired variables?
>
>
> Or in general: I'd like to select 2^m variables starting with the n-th variable
> of the original set with a distinct distance d. If m==3, n==5 and d==3 this
> should get me the following variables:
> 5, 8, 11, 14, 17, 20, 23, 26
seq(n, n + d * (2^m - 1), by=d)
seems to generate the index vector you want
Hopin' it helps,
Laurent
More information about the R-help
mailing list