I have run into an unexpected problem when including a call to ggvis::group_by in a library I'm building. This is the offending code:
x %>% gather(key, value, -x) %>% bind_rows(s) %>% ggvis(~x, ~value) %>%
layer_points(fill=~key) %>% group_by(key) %>% layer_paths(stroke=~key)
and it works great if I paste it directly into my R shell. But when I build it into a library, using:
#' @importFrom ggvis ggvis layer_points layer_paths group_by
and then try to execute that code I get this error:
Error in UseMethod("group_by_") :
no applicable method for 'group_by_' applied to an object of class "ggvis"
I see that ggvis::group_by is just UseMethod("group_by") in the dplyr namespace. I've tried importing group_by (and even also group_by_) from dplyr, but nothing helped. I'm at a loss to understand what I'm doing wrong, or conceivably I've found a bug? I did find references to this error message being due to a long-fixed bug in ggvis (6c1ebbe), which appears to add group_by_ as an export in ggvis' namespace.
I've replicated this problem under the latest ggvis (0.4.3) and both dplyr 0.5.0 and 0.7.0.
Any help will be gratefully appreciated!