Hi all, currently I'm working with physical data stored in a data.frame. I have N observations, typically 100-300 per data set. Each row in a set holds M (typically 2100) variables which represent a curve. For linear discriminant analysis I chose first to do a wavelet transform (because M >> N) and then feed the transformed data (of level L) in lda. This works fine (e.g. error < 0.01) if I take all variables or a subset of consecutive variables. But now I want to take only the even numbered variables (1st, 3rd, 5th,...) and then do the wavelet transform. 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 And for n==1 d==2 we would get the first problem. I would appreciate your help very much! Thanks, Till ________________________________________ Abos online bestellen. Oder Leser werben und Pr?mie aussuchen. http://www.epost.de/aboservice
Selecting variables from a data.frame
2 messages · Till Baumgaertel, Laurent Gautier
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