Fred J. wrote:
Philippe Grosjean [EMAIL PROTECTED] wrote: What Fred is looking for is
local minima/maxima, also known as turning
points, or pits/peaks in a series. You can look at ?turnpoints in
pastecs library.
x - c(1:4,0:5, 4, 11)
x
[1] 1 2 3 4 0 1 2 3 4 5 4 11
Philippe Grosjean [EMAIL PROTECTED] wrote: What Fred is looking for is local
minima/maxima, also known as turning
points, or pits/peaks in a series. You can look at ?turnpoints in
pastecs library.
x - c(1:4,0:5, 4, 11)
x
[1] 1 2 3 4 0 1 2 3 4 5 4 11
tp - turnpoints(x)
Hi
Is there a function which determines the location, i.e., index of the all
minimums or maximums of a numeric vector.
Which.min(x) only finds the (first) of such.
x - c(1:4,0:5, 4, 11)
x
[1] 1 2 3 4 0 1 2 3 4 5 4 11
which.min(x)
[1] 5
which.max(x)
[1]
Try
order(x, decreasing=TRUE/FALSE)
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Fred J.
Sent: Wednesday, March 15, 2006 2:32 PM
To: r-help@stat.math.ethz.ch
Subject: [R] which.minimums not which.min
Hi
Is there a function which
On Wed, 2006-03-15 at 11:32 -0800, Fred J. wrote:
Hi
Is there a function which determines the location, i.e., index of
the all minimums or maximums of a numeric vector.
Which.min(x) only finds the (first) of such.
x - c(1:4,0:5, 4, 11)
x
[1] 1 2 3 4 0 1 2 3
What you want seems to be the valleys and peaks in the data. If so, try:
RSiteSearch(find peaks)
which points to a post by Philippe Grosjean, pointing to the pastesc
package:
library(pastecs)
Loading required package: boot
tp - turnpoints(x)
which(tp$peaks)
[1] 4 10
which(tp$pits)
[1]
What Fred is looking for is local minima/maxima, also known as turning
points, or pits/peaks in a series. You can look at ?turnpoints in
pastecs library.
x - c(1:4,0:5, 4, 11)
x
[1] 1 2 3 4 0 1 2 3 4 5 4 11
tp - turnpoints(x)
summary(tp)
Turning points for: x
nbr
On Wed, 2006-03-15 at 21:45 +0100, Philippe Grosjean wrote:
What Fred is looking for is local minima/maxima, also known as turning
points, or pits/peaks in a series. You can look at ?turnpoints in
pastecs library.
x - c(1:4,0:5, 4, 11)
x
[1] 1 2 3 4 0 1 2 3 4 5 4 11