Re: [R] Apply a shift which is a function of the array.

2010-07-02 Thread Robin Hankin
Hello again Jim It seems that ashift() from the same package *doesn't* do what you want. But you can use shift() as follows: > myshift <- function(x){shift(x,1-which.max(x))} > a <- matrix(runif(30),5,6) > a [,1] [,2] [,3] [,4] [,5] [,6] [1,] 0.268955362

Re: [R] Apply a shift which is a function of the array.

2010-07-02 Thread Robin Hankin
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

[R] Apply a shift which is a function of the array.

2010-07-02 Thread Jim Hargreaves
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'