Hello Jim

you can use ashift() from the same library which does (I think) what you want.


HTH,   Robin



On 07/02/2010 12:05 PM, Jim Hargreaves wrote:
Dear List,

I have a 2,000x10,000 array of time domain data which when plotted draws a distinct pulse. The matrix is 10,000 pulses of length 2000. I would like the pulse to be shifted so that the peak (which.max of the pulse data) is consistently at point 400.

I don't want to use loops as it'll take a long time. The problem with using apply is the pulse peak varies for each pulse, so I want to use something like:

apply(really_mean_pulse, 2, shift, which.max(really_mean_pulse))

(Using the shift function from the "magic" library)

This doesn't work, so I need to modify this so that the argument to shift is dependent on the column the shift is being applied to.

Any suggestions would be greatly appreciated!

Kind Regards,
Jim Hargreaves

______________________________________________
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.


--
Robin K. S. Hankin
Uncertainty Analyst
University of Cambridge
19 Silver Street
Cambridge CB3 9EP
01223-764877

______________________________________________
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.

Reply via email to