inst/examples/ex-spread_each.R

library(dplyr)
data <- mutate(expand.grid( x = c( 'a', 'b', 'c')
                    , y = c( 'd', 'e', 'f')
                    , .rep = 1:10
                    ), v = rnorm(90))
long <- summarise(group_by(data, x, y),N=n(), sum=sum(v))

spread_each(long, y, N, sum)

Try the tidymargins package in your browser

Any scripts or data that you put into this service are public.

tidymargins documentation built on July 23, 2019, 5:04 p.m.