what's the function of ungroup() under below R code

Viewed 35

I am really new to R, and I am trying to pick it up myself. I got a code online and not really understand why there is ungroup() in the code below. To my understanding, there is no aggregate function, why we need to ungroup??

a<- a%>% 
  rowwise() %>% 
  mutate(b= sum(c, d, na.rm = TRUE)) %>% 
  ungroup() %>% 
  mutate(e= b* x)
0 Answers
Related