inst/examples/ex-with_margins.R

library(dplyr)
x <- c( 'a', 'b', 'c')
y <- c( 'd', 'e', 'f')
data <- group_by(mutate(expand.grid( x = x, y = y, .rep = 1:10),  v = rnorm(90)), x, y)
with_margins(summarise)(data, N=n(), sum=sum(v))
halpo/tidymargins documentation built on Nov. 4, 2019, 1:27 p.m.