summaryStats: Classical or Robust Descriptive Statistics

View source: R/summaryStats.R

summaryStatsR Documentation

Classical or Robust Descriptive Statistics

Description

This function calculates various descriptive statistics (robust and non-robust) for a specified variable or all variables in a given data frame or tibble.

Usage

summaryStats(x, var = NULL, digits = 2, robust = FALSE, drop.na = TRUE)

Arguments

x

A data frame or tibble.

var

A character vector specifying the variable(s) for which to calculate the summary statistics. If left as NULL (the default), summary statistics will be calculated for all variables in the data frame/tibble.

digits

An integer specifying the number of significant digits to display after the decimal point in the output.

robust

A logical value indicating whether to compute robust descriptive statistics. If FALSE (the default), computes the classical descriptive statistics for describing the distribution of a univariate variable.

drop.na

A logical value indicating whether to remove missing values (NA) from the calculations. If TRUE (the default), missing values will be removed. If FALSE, missing values will be included in the calculations.

Value

A data frame containing the summary statistics for the specified variable(s).

Author(s)

Christian L. Goueguel

Examples

# Load the iris dataset
data(iris)

# Example1:
iris |> summaryStats()

# Example2:
iris |> summaryStats(
  var = c("Sepal.Length", "Petal.Length"),
  robust = TRUE
  )


ChristianGoueguel/specProc documentation built on Nov. 9, 2024, 3:23 p.m.