plot_outlier.data.frame: Plot outlier information of numerical data diagnosis

Description Usage Arguments Details Outlier diagnostic information See Also Examples

Description

The plot_outlier() visualize outlier information for diagnosing the quality of the numerical data.

Usage

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

## S3 method for class 'data.frame'
plot_outlier(.data, ..., col = "steelblue", typographic = TRUE)

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. If the first expression is negative, plot_outlier() will automatically start with all variables. These arguments are automatically quoted and evaluated in a context where column names represent column positions. They support unquoting and splicing.

col

a color to be used to fill the bars. The default is "steelblue".

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.

Details

The scope of the diagnosis is the provide a outlier information. Since the plot is drawn for each variable, if you specify more than one variable in the ... argument, the specified number of plots are drawn.

Outlier diagnostic information

The plot derived from the numerical data diagnosis is as follows.

See vignette("diagonosis") for an introduction to these concepts.

See Also

plot_outlier.tbl_dbi, diagnose_outlier.data.frame.

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
37
38
39
40
41
42
43
44
45
46
47
# Visualization of all numerical variables
plot_outlier(heartfailure)

# Select the variable to diagnose
plot_outlier(heartfailure, cpk_enzyme, sodium)
plot_outlier(heartfailure, -cpk_enzyme, -sodium)
plot_outlier(heartfailure, "cpk_enzyme", "sodium")
plot_outlier(heartfailure, 7)

# Using the col argument
plot_outlier(heartfailure, cpk_enzyme, col = "gray")

# Not allow typographic argument
plot_outlier(heartfailure, cpk_enzyme, typographic = FALSE)

# Using pipes ---------------------------------
library(dplyr)

# Visualization of all numerical variables
heartfailure %>%
  plot_outlier()

# Positive values select variables
heartfailure %>%
  plot_outlier(cpk_enzyme, sodium)
  
# Negative values to drop variables
heartfailure %>%
  plot_outlier(-cpk_enzyme, -sodium)

# Positions values select variables
heartfailure %>%
  plot_outlier(7)

# Positions values select variables
heartfailure %>%
   plot_outlier(-1, -5)

# Using pipes & dplyr -------------------------
# Visualization of numerical variables with a ratio of
# outliers greater than 5%
# heartfailure %>%
#   plot_outlier(heartfailure %>%
#      diagnose_outlier() %>%
#      filter(outliers_ratio > 5) %>%
#      select(variables) %>%
#      pull())

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