Usage
jcorrelation(
data,
vars,
group = NULL,
method = "pearson",
alternative = "two.sided",
ci = TRUE,
ciWidth = 95,
flag = TRUE,
flagAlpha = 0.05,
plots = TRUE,
plotType = "matrix",
report = TRUE
)
Arguments
- data
The data as a data frame.
- vars
A vector of strings naming the variables to correlate.
- group
Variable to split the analysis by.
- method
The correlation method to use: 'pearson' (default), 'spearman', or 'kendall'.
- alternative
The alternative hypothesis: 'two.sided' (default), 'greater', or 'less'.
- ci
TRUE (default) or FALSE, provide confidence intervals.
- ciWidth
Confidence interval level (default: 95\
flagTRUE (default) or FALSE, flag significant correlations.
flagAlphaAlpha level for flagging significant correlations (default: 0.05).
plotsTRUE (default) or FALSE, provide correlation plots.
plotTypeType of correlation plot: 'matrix' (default), 'pairs', or 'network'.
reportTRUE (default) or FALSE, provide natural language interpretation.
A results object containing:
results$matrix | correlation matrix with significance tests | ||||
results$tests | detailed correlation tests for each pair of variables | ||||
results$summary | summary of correlation analysis | ||||
results$report | a html | ||||
results$plot | an image | ||||
results$plotMatrix | an image | ||||
results$plotPairs | an image | ||||
results$plotNetwork | an image |
asDF
or as.data.frame
. For example:results$matrix$asDF
as.data.frame(results$matrix)
Comprehensive correlation analysis including Pearson, Spearman, and Kendall
correlations with significance tests, confidence intervals, and natural
language reporting. Suitable for exploring relationships between
continuous variables.
# Basic correlation analysis
jcorrelation(
data = histopathology,
vars = c("Age", "OverallTime", "MeasurementA", "MeasurementB")
)# With grouping variable
jcorrelation(
data = histopathology,
vars = c("Age", "OverallTime", "MeasurementA"),
group = "Sex"
)