cursory: Cursory Functions

Description Usage Arguments Value Examples

Description

Cursory functions act like the dplyr summarize_(all|at|if) functions with an important difference, they put the variable name in a column and for each function passed in it puts the value in it's own column.

Usage

1
2
3
4
5
cursory_all(.tbl, .funs, ..., var.name = "Variable")

cursory_at(.tbl, .vars, .funs, ..., var.name = "Variable")

cursory_if(.tbl, .predicate, .funs, ..., var.name = "Variable")

Arguments

.tbl

A tbl object.

.funs

A function fun, a quosure style lambda ~ fun(.) or a list of either form.

...

Additional arguments for the function calls in .funs. These are evaluated only once, with tidy dots support.

var.name

Name of the column with variable names.

.vars

A list of columns generated by vars(), a character vector of column names, a numeric vector of column positions, or NULL.

.predicate

A predicate function to be applied to the columns or a logical vector. The variables for which .predicate is or returns TRUE are selected. This argument is passed to rlang::as_function() and thus supports quosure-style lambda functions and strings representing function names.

Value

A tibble with columns from the groups, the var.name column, and columns corresponding to each of function from .funs.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
library(dplyr)
data(iris)

## basic summary statistics for each variable in a data frame.
cursory_all(group_by(iris, Species), lst(mean, sd))

## summary statistics for only numeric variables.
cursory_if(iris, is.numeric, lst(mean, sd))

## summary statistics for specific variables.
cursory_at(iris, vars(ends_with("Length")), lst(Variance = var))

cursory documentation built on Aug. 22, 2019, 9:03 a.m.