Error message: Non-numeric argument to mathematical function

474 views
Skip to first unread message

Dwayne Paschall

unread,
Mar 24, 2015, 7:42:39 AM3/24/15
to unma...@googlegroups.com
I am trying to use a little function inside a shiny app. It works perfectly on my local machine. But when I upload it to shinyapps.io, I get the following error (from the shinyapps.io log files):

Error in round(frequency) : non-numeric argument to mathematical function

Its really just a simple filter operation:
highPassFilter <- function(x) {
     alpha1 <- (cos(.707*2*pi/48)+sin(.707*2*pi/48)-1)/cos(.707*2*pi/48)
     HP <- (1-alpha1/2)*(1-alpha1/2)*(x-2*lag(x)+lag(x,2))
     HP <- HP[-c(1,2)]
     HP <- filter(HP, c(2*(1-alpha1), -1*(1-alpha1)*(1-alpha1)), method="recursive")
     HP <- c(NA, NA, HP)
     HP <- xts(HP, order.by=index(x))
     return(HP)
}

Any hint at why it works locally but not on the shinyapps server?

many thanks,
d
Reply all
Reply to author
Forward
0 new messages