Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions R/cor_diff.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
cor_diff <- function(data, x, y, x2 = NULL, y2 = NULL, method = "parametric", ...) {

# If pairs are passed
if(length(x) == 2 & length(y) == 2) {
if(length(x) == 2 && length(y) == 2) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

space_around

x2 <- y[1]
y2 <- y[2]
y <- x[2]
Expand Down Expand Up @@ -57,10 +57,10 @@ cor_diff <- function(data, x, y, x2 = NULL, y2 = NULL, method = "parametric", ..
insight::check_if_installed("psych", "for 'parametric' correlation difference method")

args <- list(n = nrow(data), r12 = cor(data[[x]], data[[y]]))
if(x == x2 & y != y2) {
if(x == x2 && y != y2) {
args$r13 <- cor(data[[x]], data[[y2]])
args$r23 <- cor(data[[y]], data[[y2]])
} else if(y == y2 & x != x2) {
} else if(y == y2 && x != x2) {
args$r13 <- cor(data[[y]], data[[x2]])
args$r23 <- cor(data[[x]], data[[x2]])
} else {
Expand Down