describe: Return tidy summary of vector

View source: R/describe.R

describeR Documentation

Return tidy summary of vector

Description

Function to return a one-row dataframe with descriptives for a target vector Mirrors describe_df, but for standalone vectors.

Usage

describe(x, digits = NULL)

Arguments

x

Vector.

digits

Optional argument to round output to a specified number of digits.

Details

Will coerce using as.vector() to handle factors or labelled vectors. Count in the distinct column excludes values of NA.

Examples

describe(mtcars$mpg)
describe(mtcars$mpg, 2)
describe(mice::boys$hc)

# handling of a factor
describe(mice::boys$gen)

# NAs are excluded from the count of 'distinct'
describe(c(0, 1, 1, 0, NA))

# a common use case, distinct from describe_df()
describe(mtcars$hp / mtcars$wt)

wepelham3/sack2 documentation built on Aug. 5, 2023, 5:53 a.m.