Skip to content
This repository has been archived by the owner on Feb 9, 2024. It is now read-only.

layer_histograms not working w/o a stack = FALSE argument #470

Closed
edgararuiz-zz opened this issue Mar 31, 2017 · 1 comment
Closed

layer_histograms not working w/o a stack = FALSE argument #470

edgararuiz-zz opened this issue Mar 31, 2017 · 1 comment

Comments

@edgararuiz-zz
Copy link

Hi, I've tried the following in two different computers with today's devel version:

mtcars %>% ggvis(~mpg) %>% layer_histograms()

This is the response:

Error in eval(expr, envir, enclos) : object 'xmin_' not found

But works if I pass stack = FALSE :

mtcars %>% ggvis(~mpg) %>% layer_histograms(stack = FALSE)

From looking at the code in layer_bins.R, it seems that by equating x to compute_stack, the original compute_bin data is lost, causing the columns called by props to be dropped:

    if (stack) {
      x <- compute_stack(x, stack_var = ~count_, group_var = ~x_)

      rect_props <- merge_props(
        new_props,
        props(x = ~xmin_, x2 = ~xmax_, y = ~stack_upr_, y2 = ~stack_lwr_)
      )
      x <- emit_rects(x, rect_props)

    } else ...
@duttashi
Copy link

duttashi commented Jul 4, 2017

@edgararuiz this code, mtcars %>% ggvis(~mpg) %>% layer_histograms() works for me. My sessioninfo() is given below. Try updating the R version and let us know if the error persists. cheers.

> sessionInfo()
R version 3.3.3 (2017-03-06)
Platform: i386-w64-mingw32/i386 (32-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] bindrcpp_0.2 ggvis_0.4.3 

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants