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

GG_heatmap(): fails with NAs in correlation matrix #94

Open
Deleetdk opened this issue May 17, 2020 · 0 comments
Open

GG_heatmap(): fails with NAs in correlation matrix #94

Deleetdk opened this issue May 17, 2020 · 0 comments
Labels

Comments

@Deleetdk
Copy link
Owner

Can happen when there's rare event data, or missing pairwise data.

> #plot
> mh_cors$correlations %>% 
+   GG_heatmap(color_label = "Latent\ncorrelation",
+              font_size = 1) +
+   theme(axis.text.x = element_text(size = 7)) +
+   ggtitle("Medical history heatmap")
Error in hclust(dd) : NA/NaN/Inf in foreign function call (arg 10)

Screenshot from 2020-05-17 19-09-09

Reprex

> iris_cor = cor(iris[-5])
> iris_cor
             Sepal.Length Sepal.Width Petal.Length Petal.Width
Sepal.Length        1.000      -0.118        0.872       0.818
Sepal.Width        -0.118       1.000       -0.428      -0.366
Petal.Length        0.872      -0.428        1.000       0.963
Petal.Width         0.818      -0.366        0.963       1.000
> iris_cor[2, 1] = NA
> iris_cor[1, 2] = NA
> iris_cor
             Sepal.Length Sepal.Width Petal.Length Petal.Width
Sepal.Length        1.000          NA        0.872       0.818
Sepal.Width            NA       1.000       -0.428      -0.366
Petal.Length        0.872      -0.428        1.000       0.963
Petal.Width         0.818      -0.366        0.963       1.000
> iris_cor %>% GG_heatmap()
Error in hclust(dd) : NA/NaN/Inf in foreign function call (arg 10)

Seems difficult to do anything about, however.

@Deleetdk Deleetdk added the bug label May 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant