plot.compare_category: Visualize Information for an "compare_category" Object

Description Usage Arguments See Also Examples

Description

Visualize mosaics plot by attribute of compare_category class.

Usage

1
2
## S3 method for class 'compare_category'
plot(x, prompt = FALSE, na.rm = FALSE, typographic = TRUE, ...)

Arguments

x

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

prompt

logical. The default value is FALSE. If there are multiple visualizations to be output, if this argument value is TRUE, a prompt is output each time.

na.rm

logical. Specifies whether to include NA when plotting mosaics plot. The default is FALSE, so plot NA.

typographic

logical. Whether to apply focuses on typographic elements to ggplot2 visualization. The default is TRUE. if TRUE provides a base theme that focuses on typographic elements using hrbrthemes package.

...

arguments to be passed to methods, such as graphical parameters (see par). However, it only support las parameter. las is numeric in 0,1; the style of axis labels.

  • 0 : always parallel to the axis default,

  • 1 : always horizontal to the axis,

See Also

compare_category, print.compare_category, summary.compare_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
# Generate data for the example
heartfailure2 <- heartfailure
heartfailure2[sample(seq(NROW(heartfailure2)), 5), "smoking"] <- NA

library(dplyr)

# Compare the all categorical variables
all_var <- compare_category(heartfailure2)

# Print compare_numeric class objects
all_var

# Compare the two categorical variables
two_var <- compare_category(heartfailure2, smoking, death_event)

# Print compare_category class objects
two_var

# plot all pair of variables
plot(all_var)

# plot a pair of variables
plot(two_var)

# plot all pair of variables by prompt
plot(all_var, prompt = TRUE)
  
# plot a pair of variables without NA
plot(two_var, na.rm = TRUE)

# plot a pair of variables
plot(two_var, las = 1)

# plot a pair of variables not focuses on typographic elements
plot(two_var, typographic = FALSE)

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