corrr icon indicating copy to clipboard operation
corrr copied to clipboard

error on correlate of two table with different colsize

Open zenfey opened this issue 1 year ago • 1 comments

The problem

correlate seems do not support two input dataframe with same rowsize and different colsize, which works in base cor function.

Reproducible example

## copy your code to the clipboard and run:

library(tidyverse)
library(corrr)

iris.sub1 <- iris %>% select (Sepal.Length)
iris.sub2 <- iris %>% select (Sepal.Width, Petal.Length, Petal.Width)

correlate (iris.sub1, iris.sub2)
#> Correlation computed with
#> • Method: 'pearson'
#> • Missing treated using: 'pairwise.complete.obs'
#> Error in `as_cordf()`:
#> ! Input object x is not a square.

cor (iris.sub1, iris.sub2)
#>              Sepal.Width Petal.Length Petal.Width
#> Sepal.Length  -0.1175698    0.8717538   0.8179411

zenfey avatar Apr 22 '24 02:04 zenfey

Still true. Any likelihood of this being taken up. Sadly, I'm not enough of a programmer to offer.

cpsyctc2 avatar Apr 05 '25 17:04 cpsyctc2