corr_plot: Correlation Plot

View source: R/3-cor_plot.R

corr_plotR Documentation

Correlation Plot

Description

Function for making a correlation plot starting from a formula and a data.frame

Usage

corr_plot(x, ...)

## S3 method for class 'formula'
corr_plot(x, data, cex.labels = NULL, ...)

## S3 method for class 'data.frame'
corr_plot(
  x,
  ...,
  jitter = FALSE,
  smooth = FALSE,
  lines = TRUE,
  pch = 20,
  digits = 2,
  cex.cor = NULL,
  cex.labels = NULL,
  method = "pearson",
  stars = FALSE,
  resize = FALSE,
  hist = TRUE,
  col.bar = "RoyalBlue",
  col.bar.border = "lightblue",
  col.line = "blue",
  col.smooth = col.line,
  main = "",
  sub,
  xlab,
  ylab
)

corr_pairs(
  data,
  jitter = FALSE,
  smooth = FALSE,
  lines = TRUE,
  pch = 20,
  digits = 2,
  cex.cor = NULL,
  cex.labels = NULL,
  method = "pearson",
  stars = FALSE,
  resize = FALSE,
  hist = TRUE,
  col.bar = "RoyalBlue",
  col.bar.border = "lightblue",
  col.line = "blue",
  col.smooth = col.line,
  ...
)

corr_plot2(
  ...,
  main = "",
  type = "pearson",
  sig.level = NULL,
  r.level = 0.1,
  mar = c(1, 1, 1, 1),
  include.order = FALSE,
  method = "color",
  col = RColorBrewer::brewer.pal(100, "RdBu")
)

Arguments

x

formula oder data.frame

...

an prepare_data2

data

a data matrix

jitter

Rauschen

smooth, lines

Anpassungslienien

lines

Regressinsgerade

pch

Symbole pch=20

digits, method

correlation

cex.cor, resize

Fixe groese mit cex.cor, resize abhaengig von r-Wert

method

c("circle", "square", "ellipse", "number", "shade", "color", "pie"),

stars, resize, cex.cor

correlation formatierung

hist

Histogram TRUE/FLASE

col.bar, col.bar.border, col.line, col.smooth

Farben

main

titel

type

c("full", "lower", "upper"),

sig.level

signifikanz

col

RColorBrewer::brewer.pal(100, 'RdBu')

smooth

Gezeichnete Lineie

digits

Nachkommastellen in plot

stars

Sternchen

order

c("original", "AOE", "FPC", "hclust", "alphabet"),

diag

FALSE,

Value

nix

Examples

#' 
# require(stp25plot)
# require(stp25tools)
require(tidyverse)
n <- 500
set.seed(1)

dat<- 
  data.frame(
    a = rnorm(n)) |>
  mutate(
    b = a + rnorm(n),
    c = b / 2 + rnorm(n),
    d = c / 3 + rnorm(n),
    e = 2 - a + rnorm(n),
    f = e / 5  + rnorm(n)
  )

# cor(dat)
# cor_matrix <- Hmisc::rcorr(dat)
corr_plot( ~ a + e + f+ b + c + d,
           dat,
           resize=FALSE)

corr_plot2(dat)

#par(mfrow= c(1,2))
corr_plot2(dat, main = "patient", sig.level = .2)
corr_plot2(dat, main = "patient", 
           r.level = .2, 
           type="spearman",
           order = TRUE
) 


stp4/stp25plot documentation built on March 29, 2025, 4:26 p.m.