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

dplyr "bind_rows" integration issues #49

Closed
ghost opened this issue Feb 16, 2018 · 2 comments
Closed

dplyr "bind_rows" integration issues #49

ghost opened this issue Feb 16, 2018 · 2 comments

Comments

@ghost
Copy link

ghost commented Feb 16, 2018

I was working through some of the same code in the vignette: using tibbletime with dplyr, and noticed a problem with the print method after using bind_rows to join two tbl_time objects.

apple <- create_series('2014' ~ '2016', period = '1 hour') %>%
  mutate(price = 100 + cumsum(rnorm(26304, mean = 0, sd = .5)))

facebook <- create_series('2014' ~ '2016', period = '1 hour') %>%
  mutate(price = 150 + cumsum(rnorm(26304, mean = 0, sd = .5)))

price_series <- bind_rows(list(apple = apple, facebook = facebook), .id = "symbol") # %>%
  #  as_tbl_time(date) %>%
  #  group_by(symbol)

The price_series assignment above works, but you can't print the object until you run the next step in the pipe, %>% as_tbl_time.

R > price_series
Error in eval(expr, envir, enclos) : object '.sep' not found

I would think that you want to be ensure that breaking a pipe process at any point allows for inspection.

Thoughts?

@DavisVaughan
Copy link
Collaborator

Thanks, this is an unfortunate but known bug that has to do with bind_rows() not being a generic function. We can't define how it should interact with tbl_time objects, and unfortunately it removes attributes but not the tbl_time class. This means that when the object is printed, it prints using the tbl_time method, but cannot find the index_quo attribute required to print correctly. I have an open issue about this on dplyr, tidyverse/dplyr#3259, and others have reported similar issues with it not being generic, but I don't know when it will be fixed. The easy solution is to just pipe into as_tbl_time again to restore the attributes.

@ghost
Copy link
Author

ghost commented Feb 19, 2018

Thanks for the response. After posting, it struck me that the issue was likely with dplyr. Your response was very helpful and informative.

@ghost ghost closed this as completed Feb 19, 2018
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant