xsummarise_each: extended version of summarise_each that allows alternative...

Description Usage Arguments Examples

View source: R/xsummarise_each.r

Description

extended version of summarise_each that allows alternative arrangement of outputs

Usage

1
2
xsummarise_each(tbl, funs, ..., .long = "funs", .wide = NA,
  .fun.var = ".fun", .var.var = ".var")

Arguments

tbl

the date frame

funs

a list of functions, see the help of summarize_each, best use the helper function funs() to create them

...

columns in tbl on which the functions should be applied

.long

either "funs" or "vars". Shall variables or functions be put in different rows?

.wide

currently ignored

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## Not run: 
  library(dplyr)
  library(dplyrExtras)
  by_species <- group_by(iris,Species)
  summarise_each(by_species,funs(min=min, max=max, mean=mean), Petal.Width, Sepal.Width)
  xsummarise_each(by_species,funs(min=min, max=max(.,na.rm=TRUE)), Petal.Width, Sepal.Width, .long="vars", .var.var = "Variable")
  xsummarise_each(by_species,funs(min=min, max=max), Petal.Width, Sepal.Width, .long="funs")
  
  xsummarise_each_(by_species,funs(min, max), vars=c("Petal.Width", "Sepal.Width"))
  xsummarise_each_(by_species,funs(min, max), vars=c("Petal.Width", "Sepal.Width"), .long="vars", .var.var = "Variable")

## End(Not run)

skranz/dplyrExtras documentation built on May 20, 2020, 6:39 p.m.