r - SAX function of TSclust package generate an error -


i using tsclust package sax (symbolic aggregate aggregation) plots. in accordance example shown on page 25, using function

sax.plot(as.ts(df$power), w=30, alpha=4)  

but, generates error as:

error in if ((n <- as.integer(n[1l])) > 0) { : argument of length 0 

i not able debug it. looked source code of sax.plot function not find relevant error message typed in.

the required r dataobject can found @ link

r version: 3.2
tsclust version:1.2.3

hello apparently it's because need normalize data, check out example :

# parameters w <- 30  alpha <- 4   # paa x <- df$power paax <- paa(x, w)  plot(x, type="l", main="paa reduction of series x")  p <- rep(paax,each=length(x)/length(paax)) #just plotting paa lines(p, col="red")  # sax convert.to.sax.symbol(paax , alpha) # [1] 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 # need scale paa result convert.to.sax.symbol(scale(paax) , alpha) # [1] 1 1 1 1 1 1 1 1 1 2 2 1 4 3 3 1 2 2 2 4 4 4 1 1 2 4 3 3 4 4   # sax plot : scaling works sax.plot(as.ts(scale(df$power)), w=w, alpha=alpha)  

that's example can found in function page.


Comments

Popular posts from this blog

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

How to show in django cms breadcrumbs full path? -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -