SimplifyStats Vignette"

knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

SimplifyStats provides a set of functions to simplify the process of 1) generating descriptive statistics for the numeric variables of multiple groups and 2) performing hypothesis testing between all combinations of groups.

Generate group-wise descriptive statistics

The function group_summarize can be used to generate descriptive statistics for multiple groups based on unique combinations of the grouping variables.

library(SimplifyStats)

# Generate data.
df <- iris

# Modify df to demonstrate additional functionality.
## Add an NA.
df$Sepal.Length[1] <- NA
## Add another grouping variable.
df$Condition <- rep(c("untreated","treated"), 75)

# Generate descriptive statistics.
group_summarize(
  df, 
  group_cols = c("Species","Condition"), 
  var_cols = c("Sepal.Length","Sepal.Width"), 
  na.rm = TRUE
)

Perform pair-wise hypothesis testing

Similarly, the function pairwise_stats can be used to perform pairwise statistical tests for multiple variables based on unique combinations of the grouping variables.

# Generate descriptive statistics.
pairwise_stats(
  df, 
  group_cols = c("Species","Condition"), 
  var_cols = c("Sepal.Length", "Sepal.Width"),
  t.test
)


Try the SimplifyStats package in your browser

Any scripts or data that you put into this service are public.

SimplifyStats documentation built on April 14, 2020, 6:27 p.m.