univar_category.data.frame: Statistic of univariate categorical variables

Description Usage Arguments Details Value Attributes of return object See Also Examples

Description

The univar_category() calculates statistic of categorical variables that is frequency table

Usage

1
2
3
4
univar_category(.data, ...)

## S3 method for class 'data.frame'
univar_category(.data, ...)

Arguments

.data

a data.frame or a tbl_df.

...

one or more unquoted expressions separated by commas. You can treat variable names like they are positions. Positive values select variables; negative values to drop variables. These arguments are automatically quoted and evaluated in a context where column names represent column positions. They support unquoting and splicing.

Details

univar_category() calculates the frequency table of categorical variables. If a specific variable name is not specified, frequency tables for all categorical variables included in the data are calculated. The univar_category class returned by univar_category() is useful because it can draw chisqure tests and bar plots as well as frequency tables of individual variables. and return univar_category class that based list object.

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.

Attributes of return object

Attributes of compare_category class is as follows.

See Also

summary.univar_category, print.univar_category, plot.univar_category.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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

# plot all variables
# plot(all_var)

# plot smoking
# plot(smoking)

# plot all variables by prompt
# plot(all_var, prompt = TRUE)

bit2r/kodlookr documentation built on Dec. 19, 2021, 9:49 a.m.