Re: [R] Antwort: Re: dplyr : row total for all groups in dplyr summarise

2016-07-05 Thread David Winsemius
> On Jul 5, 2016, at 2:27 AM, g.maub...@weinwolf.de wrote: > > Hi guys, > > I checked out your example but I can't follow the results.: > >> mtcars %>% > + group_by (am, gear) %>% > + summarise (n=n()) %>% > + mutate(rel.freq = paste0(round(100 * n/sum(n), 0), "%")) %>% > + ungroup()

[R] Antwort: Re: dplyr : row total for all groups in dplyr summarise

2016-07-05 Thread G . Maubach
Hi guys, I checked out your example but I can't follow the results.: > mtcars %>% + group_by (am, gear) %>% + summarise (n=n()) %>% + mutate(rel.freq = paste0(round(100 * n/sum(n), 0), "%")) %>% + ungroup() %>% + mutate(row.tot = sum(n)) Source: local data frame [4 x 5] am gear