Re: [R] how to allign data

2018-08-03 Thread PIKAL Petr
> From: Jim Lemon > Sent: Friday, August 3, 2018 12:32 AM > To: PIKAL Petr > Cc: r-help mailing list > Subject: Re: [R] how to allign data > > Hi Petr, > I recently had to align the minima of deceleration events to form an > aggregate "braking profile" for

Re: [R] how to allign data

2018-08-02 Thread Jim Lemon
Hi Petr, I recently had to align the minima of deceleration events to form an aggregate "braking profile" for different locations. It seems as though you are looking for something like: find_increase<-function(x,surround=10) { inc_index<-which.max(diff(x)) indices<-(inc_index-surround):(inc_inde

[R] how to allign data

2018-08-02 Thread PIKAL Petr
Dear all Before I start to reinvent wheel I would like to ask you if you have some easy solution for aligning data I have something like this x<-1:100 set.seed(42) y1<-c(runif(20)+1, 1.2*x[1:80]+runif(80)) y2<-c(runif(40)+1, 1.2*x[1:60]+runif(60)) plot(x,y1) points(x,y2, col=2) with y increase