Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correlate is incorrect for a one-column data.frame #121

Closed
antoine-sachet opened this issue Oct 28, 2020 · 1 comment
Closed

Correlate is incorrect for a one-column data.frame #121

antoine-sachet opened this issue Oct 28, 2020 · 1 comment

Comments

@antoine-sachet
Copy link
Contributor

antoine-sachet commented Oct 28, 2020

This is a variant of #120. Again, you can't reproduce this because you'll hit #119 which I fixed in my fork.

When using a data.frame with only 1 column, the correlation is set to whatever the diagonal terms are set to.

corrr::correlate(mtcars["cyl"])
#> 
#> Correlation method: 'pearson'
#> Missing treated using: 'pairwise.complete.obs'
#> # A tibble: 1 x 2
#>   rowname   cyl
#>   <chr>   <dbl>
#> 1 cyl        NA

Created on 2020-10-28 by the reprex package (v0.3.0)

Note that mtcars["cyl"] is a one-column df, and not a numeric vector (which would be mtcars[["cyl"]]), hence it is a different bug.

This will be fixed in a PR I am working on, but I probably won't fix #120 since the y argument should not be here IMO.

antoine-sachet added a commit to antoine-sachet/corrr that referenced this issue Oct 28, 2020
As a side effect, correlate() now works with numeric vectors and one-column dfs.

Close tidymodels#120. Close tidymodels#121.
@github-actions
Copy link

github-actions bot commented Mar 6, 2021

This issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue.

@github-actions github-actions bot locked and limited conversation to collaborators Mar 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant