question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error creating prophet object - Error in filter_imp(.data, quo)

See original GitHub issue

I am trying to create a prophet object of my data frame by passing grouped data using the following code. Essentially, I would like my predictions at group level, therefore I subset the data frame and create prophet object for predict and then merge all groups together. However, I am not certain about the error I am receiving which seems to be from dplyr which is used by prophet library.

modelGroup <- function(x) { cdpModel <- prophet(x, changepoint.prior.scale = 0.5) cdpFuture <- make_future_dataframe(cdpModel, periods = 52, freq = "week) forecast <- predict(cdpModel, cdpFuture) return ......

Here some sample data

Week Group Count 16-01-01 A 10 17-01-01 B 15 15-01-01 C 20

I can’t seem to figure out the error, my function call subsets the data by group and passes a date and count column data frame to the function.

results <- DataTable[, lapply(.SD, modelGroup), by = DISTRICT]

Traceback:

`Error in filter_impl(.data, quo) : Result must have length 22923 not 9 17. call = filter_imp(.data, quo), cppstack = structure(list(file = “” line -1L, stack = c("usr/lib64/R/library/dplyr.so(Rcpp::exception::exception(char const*, bool)+0x73), "/usr/lib64/R/library/dplyr/libs/dplyr.so(void Rcpp::stop<int, long>(char const*, int const&, long const&)+0x55) 16. filter_imp(.data, quo) 15. filter.tbl_df(d=tvk_df(.data), …) . . . 11. dplyr::filter(., !is.na(y)) . . . 3. df %>% dplyr::filter(!is.na(y)) 2. fit.prophet(m, df, …)

  1. prophet(df = dataframe)`

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
kevalshah90commented, Jan 11, 2018

This isn’t an issue anymore. The columns had to be renamed to ds and y before passing them to the function to create prophet object and running the model. Thanks for your time.

0reactions
kevalshah90commented, Jan 11, 2018

Interesting @bletham. I verified that the dataset (x) being passed to the function always has 2 columns, weekly time stamp (ds) and y. Before the function call, the data frame is being subset with each group and only the selected 2 cols are passed to the function modelGroup.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error in filter_impl(.data, quo) - RStudio Community
I try to run a filter() command in a tidyverse piped line of code and I get this . . . Error in...
Read more >
Error: Value of SET_STRING_ELT() must be a 'CHARSXP ...
I postulate it was by some C code which is working invalidly, as I don't think you could use simple R code to...
Read more >
4 Workflow: basics | R for Data Science: Exercise Solutions
This error is a resu lt of a typo, dota instead of data . R could not find the function fliter() because we...
Read more >
Programming with dplyr
my_var <- x #> Error in eval(expr, envir, enclos): object 'x' not found filter(df, var == 1) #> Error in filter_impl(.data, quo): comparison ......
Read more >
LA crime by Districts
Error : object 'District' not found Traceback: 1. filter(arrest_2018, District == 9) 2. filter.tbl_df(arrest_2018, District == 9) 3. filter_impl(.data, quo).
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found