asardaes / dtwclust

R Package for Time Series Clustering Along with Optimizations for DTW
https://cran.r-project.org/package=dtwclust
GNU General Public License v3.0
252 stars 29 forks source link

bug in timestamp consistency #47

Closed cat630 closed 4 years ago

cat630 commented 4 years ago

If I provide a param time in plot (~,time=100), it always returns " Length mismatch between values and timestamps").

here is the source code.

timestamp consistency

if (!is.null(time) && length(time) < max(L1, L2))
    stop("Length mismatch between values and timestamps") # nocov
asardaes commented 4 years ago

You need to provide a vector, not a single value. There is an example in the documentation of tsclust:

require(scales)
t <- seq(Sys.Date(), len = length(series[[1L]]), by = "day")
gpc <- plot(pc.tadp, time = t, plot = FALSE)

gpc + ggplot2::scale_x_date(labels = date_format("%b-%Y"),
                            breaks = date_breaks("2 months"))