# NOT RUN {
require(ggplot2)
#Find length of the full waves
x <- seq(0,pi,0.01)
y <- sin(x^2*pi)
#zero method
w.z <- wave(x,y,method="zeros",smoothing="spline",smooth=0.1)
#plot wave with detected full waves using fitted 'zeros' method
p <- ggplot()+geom_point(aes(x=x,y=y))
p <- p+geom_line(data=w.z$names,aes(x=x,y=y,col=wave),alpha=0.4,size=3,inherit.aes=FALSE)
p+theme_classic()
#plot lambda as it varies with position
qplot(data=w.z$dat,x=pos1,y=l)
#trough-to-trough method
w.p <- wave(x,y,method="t2t")
qplot(data=w.p$names,x=x,y=y,col=wave)
# }
Run the code above in your browser using DataLab