I have the following script from the DTW package and I'm looking for the equivalent code of this example in ggplot framework:
library(dtw)
idx<-seq(0,6.28,len=100);
query<-sin(idx)+runif(100)/10;
reference<-cos(idx)
plot(reference);
lines(query,col="blue");
alignment<-dtw(query,reference);
#how can I add line on the ggplot plot ? with geom_segment ?
plot(reference)
lines(query[alignment$index1]~alignment$index2,col="blue")
and how to interpret the symbol tilde in this use case in the lines function ?
