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

changing k/digits argument doesn't make any difference to ggcorrmat plot correlations #93

Closed
IndrajeetPatil opened this issue Nov 21, 2018 · 3 comments

Comments

@IndrajeetPatil
Copy link
Owner

This should display correlations with 3 digits after the decimal point.

# for reproducibility
set.seed(123)

# as a default this function outputs a correlalogram plot
ggstatsplot::ggcorrmat(
  data = ggplot2::msleep,
  corr.method = "robust",                    # correlation method
  sig.level = 0.001,                         # threshold of significance
  p.adjust.method = "holm",                  # p-value adjustment method for multiple comparisons
  cor.vars = c(sleep_rem, awake:bodywt),     # a range of variables can be selected  
  cor.vars.names = c("REM sleep",            # variable names
                     "time awake", 
                     "brain weight", 
                     "body weight"), 
  matrix.type = "upper",                     # type of visualization matrix
  digits = 3,                                # no. of digits after decimal point
  colors = c("#B2182B", "white", "#4D4D4D"), 
  title = "Correlalogram for mammals sleep dataset",
  subtitle = "sleep units: hours; weight units: kilograms"
)

Created on 2018-11-21 by the reprex package (v0.2.1)

@ibecav
Copy link
Contributor

ibecav commented Dec 17, 2018

I'll look at this next.

@ibecav
Copy link
Contributor

ibecav commented Dec 17, 2018

Okay I chased this one down. It's not your code. It works perfectly every where you control but fails when you get to line 390 and call ggcorrplot. Even if I try and deliberately pass it some number of digits it does not honor the call. So I tried calling it direct at the command line using the author's examples and it fails there too. Please see reprex.

library(ggcorrplot)
#> Loading required package: ggplot2
library(dplyr)
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union
# Almost identical to help file example just selecting columns
corr <- mtcars %>% dplyr::select(mpg,hp,wt) %>% cor
ggcorrplot(corr, 
           type = "lower", 
           insig = "blank", 
           lab = TRUE, 
           digits = 4)

Created on 2018-12-17 by the reprex package (v0.2.1)

@IndrajeetPatil
Copy link
Owner Author

Thanks. I've made a PR (kassambara/ggcorrplot#16) there which should fix this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants