desc_stats {exploratory}R Documentation

Descriptive statistics

Description

Returns descriptive statistics for a numeric vector.

Usage

desc_stats(
  vector = NULL,
  output_type = "vector",
  sigfigs = 3,
  ci = TRUE,
  pi = TRUE,
  notify_na_count = NULL,
  print_dt = TRUE
)

Arguments

vector

a numeric vector

output_type

if output_type = "vector", return a vector of descriptive statistics; if output_type = "dt", return a data.table of descriptive statistics (default = "vector")

sigfigs

number of significant digits to round to (default = 3)

ci

logical. Should 95% CI be included in the descriptive stats? (default = TRUE)

pi

logical. Should 95% PI be included in the descriptive stats? (default = TRUE)

notify_na_count

if TRUE, notify how many observations were removed due to missing values. By default, NA count will be printed only if there are any NA values.

print_dt

if TRUE, print the descriptive stats data.table

Value

if output_type = "vector", the output will be a named numeric vector of descriptive statistics; if output_type = "dt", the output will be data.table of descriptive statistics.

Examples

desc_stats(1:100)
desc_stats(1:100, ci = TRUE, pi = TRUE, sigfigs = 2)
desc_stats(c(1:100, NA))
desc_stats(vector = c(1:100, NA), output_type = "dt")

[Package exploratory version 0.3.31 Index]