?order This will give you the indices that you can use.
On Mon, Sep 8, 2008 at 1:38 PM, <[EMAIL PROTECTED]> wrote: > I am using the function 'spectrum'. It returns two arrays that are > interesting to me. One would be the wieght or density of a given frequency > with the irequency given in another array. I would like to take the top 'n' > weights which would be the top 'n' frequencies contributing to the signal. > One way to do this would be to use 'sort' which would sort the weights but I > then lose which frequency that weight corresponds to. What would be the best > was to get the top 'n' indices in the weight (spec) array so I can use these > to index the corresponding frequency? > > In general this would be an indirect sort where the returned array is an > array of indices. > > Thank you. > > Kevin > > ______________________________________________ > 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. > -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? ______________________________________________ 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.