cyclize: Calculate waveform cycles

Description Usage Arguments Details Value See Also Examples

View source: R/kin.2d.R

Description

Finds discrete cycles of wave-like data using critical points (peaks and troughs).

Usage

1
cyclize(x, y, start = "peak", ...)

Arguments

x

numeric; x position

y

numeric; y position

start

character; where the cycles should start either 'peak' or ‘trough’. See Details.

...

additional arguments to be passed to features

Details

If "'start='peak'", the cycles start at critical points with high values, If "'start='trough'", cycles start at critical points with low values.

Value

A a data table including the following:

See Also

features

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
library(ggplot2)
n <- 200
d <- data.frame(
x <- sort(runif(n)),
y <- exp(-0.2 * sin(10*pi*x)) + rnorm(n, sd=0.05)
)
#start at peaks
c <- cyclize(d$x,d$y)
d$cyc <- c$cyc
qplot(d=d,x,y,col=as.factor(cyc))

 #start at troughs
c <- cyclize(d$x,d$y,start="trough")
d$cyc <- c$cyc
qplot(data=d,x,y,col=as.factor(cyc))

ckenaley/trackter documentation built on Feb. 11, 2022, 6:43 a.m.