sumnum: Summarize All Numeric Columns

View source: R/sumnum.R

sumnumR Documentation

Summarize All Numeric Columns

Description

Easily summarize at all numeric variables. Helpful for flexibly summarizing without knowing the columns. Defaults to sum but you can send a custom function through also. Typically pass in a data frame after group_by.

Usage

sumnum(x, do.fun = NULL, except = c(), do.ungroup = TRUE, ...)

Arguments

x

Grouped tibble to summarize.

do.fun

Function to use for the summary. Passed to dplyr::summarize(). Can be a custom function. Defaults to sum().

except

Columns names, numbers, or a logical vector indicating columns NOT to summarize.

do.ungroup

Run dplyr::ungroup() after summarizing the prevent future issues with grouping.

...

Extra args passed to dplyr::summarize() which are applied as arguments to the function passed in do.fun.

Value

Summarized data frame or tibble.

Examples


require(dplyr)
require(easyr)

sumnum( group_by( cars, speed ) )
sumnum( group_by( cars, speed ), mean )
sumnum( cars )


oliver-wyman-actuarial/easyR documentation built on Jan. 27, 2024, 4:35 a.m.