Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

check_datevar(dt_input) error in 3.7.0 #448

Closed
nie-moviestarplanet opened this issue Jul 29, 2022 · 6 comments
Closed

check_datevar(dt_input) error in 3.7.0 #448

nie-moviestarplanet opened this issue Jul 29, 2022 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@nie-moviestarplanet
Copy link

nie-moviestarplanet commented Jul 29, 2022

Project Robyn

Describe issue

When upgrading to version 3.7.0 I get the following error:

Error in check_datevar(dt_input, date_var) : 
  DATE data has to be daily, weekly or monthly

I've been using the same dataset in 3.6.3 and below and it works perfectly fine.

Environment & Robyn version

R version 3.7.0

@laresbernardo
Copy link
Collaborator

Hi @nie-moviestarplanet
Is this happening for your own data or the demo? Can you please check your "DATE" class? What format is it in? Can't debug without a reproducible example. Thanks for sharing.

@laresbernardo laresbernardo self-assigned this Jul 29, 2022
@nie-moviestarplanet
Copy link
Author

Found the issue. The data was not ordered by date. After applying ascending order it now works. I guess this was not a requirement for previous versions?

@laresbernardo
Copy link
Collaborator

We haven't added new checks on that check_datevar() really. And we do sort the dates in ascending order before we check that. So I'm not sure why or how you got that error. If you'd like to give me a reproducible example ideal, if everything's OK, feel free to close this ticket. Cheers!

@nie-moviestarplanet
Copy link
Author

I have attached the dataset that I'm using.

This is the code to reproduce the error:

library(Robyn)
library(readr)

robyn_test <- read_csv("robyn_test.csv")
robyn_test$DATE = as.Date(robyn_test$DATE,  format = "%m/%d/%Y")
robyn_test_ordered <- robyn_test[order(robyn_test$DATE),] # It works when using robyn_test_ordered

data("dt_prophet_holidays")

InputCollect <- robyn_inputs(
  dt_input = robyn_test
  ,dt_holidays = dt_prophet_holidays
  ,date_var = "DATE" 
  ,dep_var = "DEP_VAR" 
  ,dep_var_type = "conversion" 
  ,prophet_vars = c("trend", "season", "holiday", "weekday") 
  ,prophet_country = "US"
  ,context_vars = NULL 
  ,paid_media_spends = "MEDIA_S" 
  ,paid_media_vars = "MEDIA_I" 
  ,organic_vars = NULL 
  ,factor_vars = NULL 
  ,window_start = "2022-01-01"
  ,window_end = "2022-07-28"
  ,adstock = "geometric" 
)

robyn_test.csv

@laresbernardo
Copy link
Collaborator

Thanks a lot for your reproducible example @nie-moviestarplanet that did the trick!
It's been fixed now. No need to manually sort the dates before passing the data.frame to robyn_inputs()
Feel free to test and close this ticket.

@laresbernardo laresbernardo added the bug Something isn't working label Jul 29, 2022
@nie-moviestarplanet
Copy link
Author

It works now. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants