Learn R Programming

aridagri (version 2.0.3)

correlation_analysis: Correlation Analysis with Significance

Description

Computes correlation matrix with significance levels and generates publication-ready correlation table and plot.

Usage

correlation_analysis(
  data,
  method = "pearson",
  plot = TRUE,
  digits = 3,
  verbose = TRUE
)

Value

List with correlation matrix and significance matrix

Arguments

data

Data frame with numeric variables

method

Correlation method: "pearson", "spearman", or "kendall"

plot

Logical, whether to generate correlation plot

digits

Number of decimal places

verbose

Logical. If TRUE (default), prints formatted output to console.

Author

Lalit Kumar Rolaniya, ICAR-IIPR, Bikaner

Examples

Run this code
data <- data.frame(
  yield = c(1200, 1350, 1100, 1450, 1280),
  wue = c(4.2, 4.8, 3.9, 5.1, 4.5),
  protein = c(22.1, 23.5, 21.8, 24.2, 22.9)
)
correlation_analysis(data)

Run the code above in your browser using DataLab