slipper icon indicating copy to clipboard operation
slipper copied to clipboard

group_by() functionality

Open ajbass opened this issue 8 years ago • 4 comments

could be cool to add

ajbass avatar Dec 09 '16 01:12 ajbass

Do you have an example of a case you'd like to work so I can work from that?

jtleek avatar Dec 09 '16 15:12 jtleek

Sorry for not clarifying ... So bootstrapping within each group:

library(slipper)
mtcars %>%
 group_by(cyl) %>%
 slipper(mean(mpg),B=100)

mtcars %>%
 group_by(cyl) %>%
 slipper_lm(mpg ~ disp,B=100)

So I think the only way to do this (currently) is to go through each grouping factor:

mtcars %>%
 filter(cyl == 6) %>%
 slipper(mean(mpg),B=100)

(Please correct me if I am misusing the package and it can already do this.)

ajbass avatar Dec 09 '16 15:12 ajbass

No you are definitely right. This would be fun to add. Maybe over the holidays :) I think I just need to write a method for the grouped_df class maybe?

jtleek avatar Dec 09 '16 15:12 jtleek

quick hack:

tmp <- mtcars %>%
  group_by(cyl) %>%
  do(slipper_lm(mpg ~ disp, B = 100, df = .))

ajbass avatar Mar 10 '17 19:03 ajbass