Error: Class 'character' is not a known index class.
edgBR opened this issue · 0 comments
edgBR commented
Dear colleagues,
I am trying to wrap the Anomalize pipeline in a custom function that I want to apply interactively to compare the input with a classification method.
The function is as follows:
CleaningAnomalies <- function(df, alpha_val, max_anoms) {
df_test <- df %>% time_decompose(global_demand, method = "twitter") %>%
anomalize(remainder, method = "gesd", alpha=alpha_val, max_anoms = max_anom_percentage) %>%
clean_anomalies()
return(df_test)
}
Then I call the function as follows and I get the displaying error:
my_df <- CleaningAnomalies(my_df, 0.05, 0.2)
Error: Class 'character' is not a known index class.
In addition: Warning messages:
1: In to_posixct_numeric.default(index) : NAs introduced by coercion
2: In to_posixct_numeric.default(index) : NAs introduced by coercion
Called from: glue_stop("Class '{class(x)}' is not a known index class.")
Whenever I apply the pipe directly it works like charm. When I try to debug it appears that it fails in the following step:
function (..., .sep = "")
{
stop(glue::glue(..., .sep, .envir = parent.frame()), call. = FALSE)
}
Does someone have any idea of why this is happening?