corrplot_df: Correlation plot from a data frame

Description Usage Arguments Value See Also Examples

View source: R/corrplot_df.R

Description

Correlation plot from a data frame, a wrapper around corrplot::corrplot()

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
corrplot_df(
  df,
  ...,
  method_cor = "pearson",
  method_plot = "custom",
  na.rm_type = "rows",
  type = "upper",
  tl.srt = 45,
  tl.col = "black",
  sig.level = 0.05,
  insig = "blank"
)

Arguments

df

Data frame

...

Pass to corrplot::corrplot() argument

method_cor

Character: Specify method for calculate correlation; "pearson" (default), "spearman" or "kendall"

method_plot

Character: Specify plotting output; "custom" (default) other options are "circle", "square", "ellipse", "number", "shade", "color", "pie" .

na.rm_type

Character: If NA's is present in data frame, it will be removed by "rows"(default): any rows that has NA's or "cols" any column that has NA's.

type

Character: "upper" (default), "lower" or "full", display full matrix, lower triangular or upper triangular matrix.

tl.srt

Numeric: For text label string rotation in degrees.

tl.col

Character: Specify text color "black" (default)

sig.level

Numeric: P-value significant level, default = 0.05.

insig

Character: Character, specialized insignificant correlation coefficients, "pch" (default), "p-value", "blank", "n", or "label_sig". If "blank", wipe away the corresponding glyphs; if "p-value", add p-values the corresponding glyphs; if "pch", add characters (see pch for details) on corresponding glyphs; if "n", don't take any measures; if "label_sig", mark significant correlations with pch (see sig.level).

Value

Plot

See Also

corrplot package https://cran.r-project.org/web/packages/corrplot/vignettes/corrplot-intro.html

Examples

1
2
3
4
5
6
7
8
# Plot correlation of numeric column
corrplot_df(iris)

mtcars %>%
  corrplot_df(method_plot = "circle", # specify graphic method of correlation
             type = "lower",         # display lower half of correlation plot
             sig.level = 0.01,       # p-value = 0.01
             insig = "pch")          # insignificant p-value will be crossed out

Lightbridge-AI/lbr documentation built on Dec. 27, 2021, 8:09 p.m.