briandk / granovaGG

Bob Pruzek and Jim Helmreich's implementation of Elemental Graphics for Analysis of Variance
Other
15 stars 4 forks source link

granovagg.ds fails even with sensible data #168

Open briandk opened 7 years ago

briandk commented 7 years ago
library(ggplot2)
library(granovaGG)
library(magrittr)

ggplot2::mpg %>% 
  select(cty, hwy) %>% 
  granovaGG::granovagg.ds(data = .)

produces this error

Error: Length of logical index vector must be 1 or 1, got: 234

WilDoane commented 7 years ago

This seems to be a tibble issue.Notice that it works for a data.frame:

mtcars %>% select(cyl, mpg) %>% granovagg.ds(data = .)

That suggests that we're subsetting the DF somewhere and assuming we would get a vector back. Tibbles don't behave that way.

ggplot2::mpg[, 1] ggplot2::mpg['model']

both return tibbles

mtcars[, 1] mtcars[, 'cyl']

both return vectors.

briandk commented 7 years ago

@WilDoane you were right on the money: it was failing because of the tibbles. The hard part was figuring out which part was failing. Turns out it was the t.test() function. An unlikely culprit.

But, if I did this right, the fix is just two lines.