Giter Site home page Giter Site logo

jhrcook / ggasym Goto Github PK

View Code? Open in Web Editor NEW
13.0 2.0 3.0 27.82 MB

Plots three different color schemes on the top-left and bottom-right triangles and the diagonal of a symmetric matrix

Home Page: https://jhrcook.github.io/ggasym/index.html

License: GNU General Public License v3.0

R 100.00%
ggplot2 asymmetric-matrix plotting r matrix plot asymmetric ggplot

ggasym's Issues

`asymmetrize` example

Change the example so that a warning is not printed. The warning is good, but not really good to show in the showcase. Also show how the function observes groups from group_by – talk it up in the @description, too.

CRAN Check Failure for Upcoming broom Release

Hi there! The broom dev team just ran reverse dependency checks on the upcoming broom 0.7.0 release and found new errors/test failures for the CRAN version of this package. I've pasted the results below.

  • checking tests ...
     ERROR
    Running the tests in ‘tests/testthat.R’ failed.
    Last 13 lines of output:
      > 
      > test_check("ggasym")
      Error : No tidy method for objects of class character
      [31m──[39m [31m1. Error: stats asymmetrization works (@test-asymmetrise_stats.R#13) [39m [31m───────[39m
      Could not handle input data; try turning into a tibble using the broom package
      [1mBacktrace:[22m
      [90m 1. [39mtestthat::expect_warning(prepare_data(grps))
      [90m 6. [39mggasym::prepare_data(grps)
      
      ══ testthat results  ═══════════════════════════════════════════════════════════
      [ OK: 260 | SKIPPED: 0 | WARNINGS: 1 | FAILED: 1 ]
      1. Error: stats asymmetrization works (@test-asymmetrise_stats.R#13) 
      
      Error: testthat unit tests failed
      Execution halted
    

I believe these result from the following line in test-asymmetrise_stats:

expect_warning(prepare_data(grps))

broom now errors when given input data for which there are no tidiers.

We hope to submit this new version of the package to CRAN in the coming weeks. If you encounter any problems fixing these issues, please feel free to reach out!🙂

difficulty plotting with `correlation` package output

I have gone through the vignettes and adapted my dataframe accordingly but still can't seem to get this to work.

# setup
set.seed(123)
library(tidyverse)
library(ggasym)
library(parameters)
library(correlation)

# dataframe with cprrelations
(df <- as.data.frame(correlation(iris)))
#>     Parameter1   Parameter2          r     CI_low     CI_high         t  df
#> 1 Sepal.Length  Sepal.Width -0.1175698 -0.2726932  0.04351158 -1.440287 148
#> 2 Sepal.Length Petal.Length  0.8717538  0.8270363  0.90550805 21.646019 148
#> 3 Sepal.Length  Petal.Width  0.8179411  0.7568971  0.86483606 17.296454 148
#> 4  Sepal.Width Petal.Length -0.4284401 -0.5508771 -0.28794993 -5.768449 148
#> 5  Sepal.Width  Petal.Width -0.3661259 -0.4972130 -0.21869663 -4.786461 148
#> 6 Petal.Length  Petal.Width  0.9628654  0.9490525  0.97298532 43.387237 148
#>              p  Method n_Obs
#> 1 1.518983e-01 Pearson   150
#> 2 5.193337e-47 Pearson   150
#> 3 9.301992e-37 Pearson   150
#> 4 1.353994e-07 Pearson   150
#> 5 8.146457e-06 Pearson   150
#> 6 2.805002e-85 Pearson   150

# modifying it to the format expected by ggasym
(asymmat_tib <- 
  tidyr::unite(
  df,
  "contrast",
  Parameter1:Parameter2,
  remove = FALSE
) %>%
  asymmetrise_stats(.) %>%
  parameters::standardize_names(., "broom") %>%
  tibble::as_tibble())
#> # A tibble: 61 x 13
#>    contrast parameter1 parameter2 estimate conf.low conf.high statistic    df
#>    <chr>    <chr>      <chr>         <dbl>    <dbl>     <dbl>     <dbl> <int>
#>  1 Sepal.L… Sepal.Len… Sepal.Wid…   -0.118   -0.273    0.0435     -1.44   148
#>  2 Sepal.L… Sepal.Len… Petal.Len…    0.872    0.827    0.906      21.6    148
#>  3 Sepal.L… Sepal.Len… Petal.Wid…    0.818    0.757    0.865      17.3    148
#>  4 Sepal.W… Sepal.Wid… Petal.Len…   -0.428   -0.551   -0.288      -5.77   148
#>  5 Sepal.W… Sepal.Wid… Petal.Wid…   -0.366   -0.497   -0.219      -4.79   148
#>  6 Petal.L… Petal.Len… Petal.Wid…    0.963    0.949    0.973      43.4    148
#>  7 Sepal.L… Sepal.Len… Sepal.Wid…   -0.118   -0.273    0.0435     -1.44   148
#>  8 Sepal.L… Sepal.Len… Petal.Len…    0.872    0.827    0.906      21.6    148
#>  9 Sepal.L… Sepal.Len… Petal.Wid…    0.818    0.757    0.865      17.3    148
#> 10 Sepal.W… Sepal.Wid… Petal.Len…   -0.428   -0.551   -0.288      -5.77   148
#> # … with 51 more rows, and 5 more variables: p.value <dbl>, method <chr>,
#> #   n.obs <int>, x <chr>, y <chr>

# plot
ggplot(asymmat_tib, aes(x = x, y = y)) +
  geom_asymmat(aes(fill_tl = estimate, fill_br = -log(p.value)))

Created on 2020-12-22 by the reprex package (v0.3.0)

Session info
devtools::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#>  setting  value                       
#>  version  R version 4.0.3 (2020-10-10)
#>  os       macOS Mojave 10.14.6        
#>  system   x86_64, darwin17.0          
#>  ui       X11                         
#>  language (EN)                        
#>  collate  en_US.UTF-8                 
#>  ctype    en_US.UTF-8                 
#>  tz       Europe/Berlin               
#>  date     2020-12-22                  
#> 
#> ─ Packages ───────────────────────────────────────────────────────────────────
#>  package     * version date       lib source        
#>  assertthat    0.2.1   2019-03-21 [1] CRAN (R 4.0.2)
#>  backports     1.2.1   2020-12-09 [1] CRAN (R 4.0.3)
#>  bayestestR    0.8.0   2020-12-05 [1] CRAN (R 4.0.3)
#>  broom         0.7.3   2020-12-16 [1] CRAN (R 4.0.3)
#>  callr         3.5.1   2020-10-13 [1] CRAN (R 4.0.2)
#>  cellranger    1.1.0   2016-07-27 [1] CRAN (R 4.0.2)
#>  cli           2.2.0   2020-11-20 [1] CRAN (R 4.0.3)
#>  colorspace    2.0-0   2020-11-11 [1] CRAN (R 4.0.2)
#>  correlation * 0.5.0   2020-12-02 [1] CRAN (R 4.0.3)
#>  crayon        1.3.4   2017-09-16 [1] CRAN (R 4.0.2)
#>  curl          4.3     2019-12-02 [1] CRAN (R 4.0.1)
#>  DBI           1.1.0   2019-12-15 [1] CRAN (R 4.0.2)
#>  dbplyr        2.0.0   2020-11-03 [1] CRAN (R 4.0.2)
#>  desc          1.2.0   2018-05-01 [1] CRAN (R 4.0.2)
#>  devtools      2.3.2   2020-09-18 [1] CRAN (R 4.0.2)
#>  digest        0.6.27  2020-10-24 [1] CRAN (R 4.0.2)
#>  dplyr       * 1.0.2   2020-08-18 [1] CRAN (R 4.0.2)
#>  effectsize    0.4.1   2020-12-07 [1] CRAN (R 4.0.3)
#>  ellipsis      0.3.1   2020-05-15 [1] CRAN (R 4.0.2)
#>  evaluate      0.14    2019-05-28 [1] CRAN (R 4.0.1)
#>  fansi         0.4.1   2020-01-08 [1] CRAN (R 4.0.2)
#>  farver        2.0.3   2020-01-16 [1] CRAN (R 4.0.2)
#>  forcats     * 0.5.0   2020-03-01 [1] CRAN (R 4.0.2)
#>  fs            1.5.0   2020-07-31 [1] CRAN (R 4.0.2)
#>  generics      0.1.0   2020-10-31 [1] CRAN (R 4.0.2)
#>  ggasym      * 0.1.5   2020-07-15 [1] CRAN (R 4.0.2)
#>  ggplot2     * 3.3.2   2020-06-19 [1] CRAN (R 4.0.2)
#>  glue          1.4.2   2020-08-27 [1] CRAN (R 4.0.2)
#>  gtable        0.3.0   2019-03-25 [1] CRAN (R 4.0.2)
#>  haven         2.3.1   2020-06-01 [1] CRAN (R 4.0.2)
#>  highr         0.8     2019-03-20 [1] CRAN (R 4.0.2)
#>  hms           0.5.3   2020-01-08 [1] CRAN (R 4.0.2)
#>  htmltools     0.5.0   2020-06-16 [1] CRAN (R 4.0.2)
#>  httr          1.4.2   2020-07-20 [1] CRAN (R 4.0.2)
#>  insight       0.11.1  2020-12-08 [1] CRAN (R 4.0.3)
#>  jsonlite      1.7.2   2020-12-09 [1] CRAN (R 4.0.3)
#>  knitr         1.30    2020-09-22 [1] CRAN (R 4.0.2)
#>  lifecycle     0.2.0   2020-03-06 [1] CRAN (R 4.0.2)
#>  lubridate     1.7.9.2 2020-11-13 [1] CRAN (R 4.0.3)
#>  magrittr      2.0.1   2020-11-17 [1] CRAN (R 4.0.3)
#>  memoise       1.1.0   2017-04-21 [1] CRAN (R 4.0.2)
#>  mime          0.9     2020-02-04 [1] CRAN (R 4.0.2)
#>  modelr        0.1.8   2020-05-19 [1] CRAN (R 4.0.2)
#>  munsell       0.5.0   2018-06-12 [1] CRAN (R 4.0.2)
#>  parameters  * 0.10.1  2020-12-08 [1] CRAN (R 4.0.3)
#>  pillar        1.4.7   2020-11-20 [1] CRAN (R 4.0.3)
#>  pkgbuild      1.2.0   2020-12-15 [1] CRAN (R 4.0.3)
#>  pkgconfig     2.0.3   2019-09-22 [1] CRAN (R 4.0.2)
#>  pkgload       1.1.0   2020-05-29 [1] CRAN (R 4.0.2)
#>  prettyunits   1.1.1   2020-01-24 [1] CRAN (R 4.0.2)
#>  processx      3.4.5   2020-11-30 [1] CRAN (R 4.0.3)
#>  ps            1.5.0   2020-12-05 [1] CRAN (R 4.0.3)
#>  purrr       * 0.3.4   2020-04-17 [1] CRAN (R 4.0.2)
#>  R6            2.5.0   2020-10-28 [1] CRAN (R 4.0.2)
#>  Rcpp          1.0.5   2020-07-06 [1] CRAN (R 4.0.2)
#>  readr       * 1.4.0   2020-10-05 [1] CRAN (R 4.0.2)
#>  readxl        1.3.1   2019-03-13 [1] CRAN (R 4.0.2)
#>  remotes       2.2.0   2020-07-21 [1] CRAN (R 4.0.2)
#>  reprex        0.3.0   2019-05-16 [1] CRAN (R 4.0.2)
#>  rlang         0.4.9   2020-11-26 [1] CRAN (R 4.0.3)
#>  rmarkdown     2.6     2020-12-14 [1] CRAN (R 4.0.3)
#>  rprojroot     2.0.2   2020-11-15 [1] CRAN (R 4.0.3)
#>  rvest         0.3.6   2020-07-25 [1] CRAN (R 4.0.2)
#>  scales        1.1.1   2020-05-11 [1] CRAN (R 4.0.2)
#>  sessioninfo   1.1.1   2018-11-05 [1] CRAN (R 4.0.2)
#>  stringi       1.5.3   2020-09-09 [1] CRAN (R 4.0.2)
#>  stringr     * 1.4.0   2019-02-10 [1] CRAN (R 4.0.2)
#>  testthat      3.0.1   2020-12-17 [1] CRAN (R 4.0.3)
#>  tibble      * 3.0.4   2020-10-12 [1] CRAN (R 4.0.2)
#>  tidyr       * 1.1.2   2020-08-27 [1] CRAN (R 4.0.2)
#>  tidyselect    1.1.0   2020-05-11 [1] CRAN (R 4.0.2)
#>  tidyverse   * 1.3.0   2019-11-21 [1] CRAN (R 4.0.2)
#>  usethis       2.0.0   2020-12-10 [1] CRAN (R 4.0.3)
#>  utf8          1.1.4   2018-05-24 [1] CRAN (R 4.0.2)
#>  vctrs         0.3.6   2020-12-17 [1] CRAN (R 4.0.3)
#>  withr         2.3.0   2020-09-22 [1] CRAN (R 4.0.2)
#>  xfun          0.19    2020-10-30 [1] CRAN (R 4.0.2)
#>  xml2          1.3.2   2020-04-23 [1] CRAN (R 4.0.2)
#>  yaml          2.2.1   2020-02-01 [1] CRAN (R 4.0.2)
#> 
#> [1] /Users/patil/Library/R/4.0/library
#> [2] /Library/Frameworks/R.framework/Versions/4.0/Resources/library

Failure with dev scales

The development version of scales now uses farver to perform colour interpolation. This has result in a few non-perceptual changes to changes, and it looks like you're testing for exact equality:

 Failure: scale_fill_tl/br/diag_gradient2 values populate properly (@test-scale_continuous_asym.R#185)
  g3_build$data[[3]]$fill_diag not equal to `diag_cols`.
  2/6 mismatches
  x[1]: "#E40081"
  y[1]: "#E30081"
  
  x[3]: "#E40081"
  y[3]: "#E30081"

Would you mind relaxing the test so I can get scales to CRAN in the next week or so?

Failure with upcoming ggplot2 release

We have detected the following issue with the next ggplot2 release

ggasym

Run cloud_details(, "ggasym") for more info

Newly broken

  • checking tests ... ERROR
      Running ‘spelling.R’
      Running ‘testthat.R’
    Running the tests in ‘tests/testthat.R’ failed.
    Complete output:
      > library(testthat)
      > library(ggasym)
      > 
      > test_check("ggasym")
      ── 1. Failure: geom_asymmat works (@test-geom_asymmat.R#48)  ───────────────────
      `ggplot_build(g_asymmat)` produced warnings.
      
      ══ testthat results  ═══════════════════════════════════════════════════════════
      [ OK: 266 | SKIPPED: 0 | WARNINGS: 36 | FAILED: 1 ]
      1. Failure: geom_asymmat works (@test-geom_asymmat.R#48) 
      
      Error: testthat unit tests failed
      Execution halted
    

Looking into it, the issue is in this line

if (class(.x_data) == "factor" | class(.y_data) == "factor") {

where you check for factor inheritance by comparing the class attribute with "factor". As the class attribute may be longer than one (and in the new release is for discrete mappings), you'll get the warning the condition has length > 1 and only the first element will be used. To fix this, change the class check to use inherit():

if (inherit(.x_data, "factor") | inherit(.y_data, "inherit")) {
...

which is the correct way to check for class inheritance.

We will submit ggplot2 v3.3.1 in two weeks, so please submit a fix before then — you are welcome to reach out with any questions

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.