Re: [R] Discover significant change in sorted vector

2009-04-22 Thread Hans-Henning Gabriel
ucchange) bp <- breakpoints(a ~ ix, h = 4) bp Optimal 3-segment partition: Call: breakpoints.formula(formula = a ~ ix, h = 4) Breakpoints at observation number: 7 11 Corresponding to breakdates: 0.3684211 0.5789474 plot(a ~ ix) lines(ix, fitted(bp)) On Wed, Apr 22, 2009 at 7:27 A

Re: [R] Discover significant change in sorted vector

2009-04-22 Thread Hans-Henning Gabriel
Hans-Henning Gabriel wrote: Hi, suppose I have a simple sorted vector like this: a <- c(2,3,3,5,6,8,8,9,15, 25, 34,36,36,38,41,43,44,44,46); Is there a function in R, I can use to discover that from index 8 to index 11 the values are changing significantly? The function should retur

[R] Discover significant change in sorted vector

2009-04-22 Thread Hans-Henning Gabriel
Hi, suppose I have a simple sorted vector like this: a <- c(2,3,3,5,6,8,8,9,15, 25, 34,36,36,38,41,43,44,44,46); Is there a function in R, I can use to discover that from index 8 to index 11 the values are changing significantly? The function should return a value pointing to one of the indic

Re: [R] group by-like statement for 2-row matrix

2009-04-08 Thread Hans-Henning Gabriel
5, 1, 6, > 1), .Dim = c(2L, 9L)) > tapply(x[2,],x[1,],sum) > #2 3 4 5 6 > #2 2 7 3 1 > > HTH, > > Jorge > > > On Tue, Apr 7, 2009 at 11:06 AM, Hans-Henning Gabriel > > wrote: > Hi, > > my problem is as follows: > > I have a matrix of tw

[R] group by-like statement for 2-row matrix

2009-04-07 Thread Hans-Henning Gabriel
Hi, my problem is as follows: I have a matrix of two rows like this: 2 2 3 4 4 4 5 5 6 1 1 2 1 3 3 2 1 1 Can I apply something like "group by" in sql? What I want to achieve is the some of second row for each unique entry of first row: 2 -> 2 (=1+1) 3 -> 2 4 -> 7 (=1+3+3) 5 -> 3 (=2+1) 6 -