[R] fft question

Prof Brian Ripley ripley at stats.ox.ac.uk
Fri Mar 12 12:59:42 CET 2004


On Fri, 12 Mar 2004, Frank Gerrit Zoellner wrote:

> On Thu, Mar 11, 2004 at 06:14:02PM +0100, Martin Maechler wrote:
> 
> > 
> > Yes, manually, like
> > 
> >   fx <- fft(rep(x, 4))
> > 
> 
> I think rep works on a vector but in my case x is a dataframe/matrix with the signal along the rows.
> 
> Does rep work on dataframes ?

Yes, but it does not do what you want I believe.

A data frame (sic) is a list, and so the columns are replicated to form a 
list.

Row indexing will work for a data frame or matrix. Say

fft(x[rep(1:now(x), 4), ])

?

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list