summary.univar_category: Summarizing univar_category information

View source: R/univariate.R

summary.univar_categoryR Documentation

Summarizing univar_category information

Description

print and summary method for "univar_category" class.

Usage

## S3 method for class 'univar_category'
summary(object, na.rm = TRUE, ...)

## S3 method for class 'univar_category'
print(x, ...)

Arguments

object

an object of class "univar_category", usually, a result of a call to univar_category().

na.rm

logical. Specifies whether to include NA when performing a chi-square test. The default is TRUE, where NA is removed and aggregated.

...

further arguments passed to or from other methods.

x

an object of class "univar_category", usually, a result of a call to univar_category().

Details

print.univar_category() displays only the information of variables included in univar_category. The "variables" attribute is not displayed.

Value

An object of the class as individual variables based list. The information to examine the relationship between categorical variables is as follows each components.

  • variable : factor. The level of the variable. 'variable' is the name of the variable.

  • statistic : numeric. the value the chi-squared test statistic.

  • p.value : numeric. the p-value for the test.

  • df : integer. the degrees of freedom of the chi-squared test.

See Also

plot.univar_category.

Examples


library(dplyr)

# Calculates the all categorical variables
all_var <- univar_category(heartfailure)

# Print univar_category class object
all_var

# Calculates the only smoking variable
all_var %>% 
  "["(names(all_var) %in% "smoking")

smoking <- univar_category(heartfailure, smoking)

# Print univar_category class object
smoking

# Filtering the case of smoking included NA 
smoking %>%
  "[["(1) %>% 
  filter(!is.na(smoking))

# Summary the all case : Return a invisible copy of an object.
stat <- summary(all_var)

# Summary by returned object
stat



dlookr documentation built on July 9, 2023, 6:31 p.m.