R的新成員 使用dplyr,嘗試group_by多個變量,彙總多個變量,多個函數。dplyr組由多個變量彙總多個變量
可正常工作
mtcars %>%
+ group_by(cyl,hp) %>%
+ summarise(min_mpg = min(mpg) , min_disp = min(disp), max_mpg = max(mpg) , max_disp = max(disp))
但是,當我試圖用我的DF
vmp %>%
+ group_by(Priority,LOS) %>%
+ summarise(inv_total = sum(Inv_Total), sr_count = count(SR_Nmbr))
複製我收到此錯誤:
Error in summarise_impl(.data, dots) : Evaluation error: no applicable method for 'groups' applied to an object of class "factor".
我在做什麼錯? THX