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

prep release 0.3.2 #33

Merged
merged 1 commit into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: easyalluvial
Title: Generate Alluvial Plots with a Single Line of Code
Version: 0.3.1.900
Version: 0.3.2
Authors@R: person( "Bjoern", "Koneswarakantha", role = c("aut","cre"), email = "[email protected]", comment = c(ORCID = "0000-0003-4585-7799") )
URL: https://github.com/erblast/easyalluvial/
Description: Alluvial plots are similar to sankey diagrams and visualise categorical data
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Version 0.3.2 submitted to CRAN 20231207
- check for vip pkg installation before executing example of alluvial_model_response_parsnip
- option for using geom_text instead of geom_label (by https://github.com/gernophil)

# Version 0.3.1 submitted to CRAN 20220704
- cleanup package dependencies

Expand Down
4 changes: 2 additions & 2 deletions R/alluvial_model_response.R
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,8 @@ tidy_imp = function(imp, df, .f = max, resp_var = NULL){
#' \code{\link[easyalluvial]{manip_bin_numerics}}, while leaving categoric
#' variables unchanged. The number of bins for each numeric variable is set to
#' bins -2. Next the median is picked for each of the bins and the min and the
#' max value is added for each numeric variable So that we get { median(bin) X
#' bins -2, max, min} for each numeric variable. Then all possible combinations
#' max value is added for each numeric variable So that we get (median(bin) X
#' bins -2, max, min) for each numeric variable. Then all possible combinations
#' between those values and the categoric factor levels are created. The total
#' number of all possible combinations defines the range of the data space. The
#' values of the remaining variables are set to mode(factors) or
Expand Down
2 changes: 1 addition & 1 deletion R/alluvial_wide.R
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ alluvial_wide = function( data

data_key = data_new %>%
mutate( alluvial_id = manip_factor_2_numeric(alluvial_id) ) %>%
left_join( data_alluvial ) %>%
left_join( data_alluvial, relationship = "many-to-many" ) %>%
select( - fill_flow, -fill_value, -fill ) %>%
spread( key = x, value = value ) %>%
select( one_of(id_str, variables, 'alluvial_id', 'n' ) ) %>%
Expand Down
1 change: 0 additions & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ knitr::opts_chunk$set(

# easyalluvial <a href='https://erblast.github.io/easyalluvial'><img src='man/figures/logo.png' align="right" height="139" /></a>

[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/erblast/easyalluvial?branch=master&svg=true)](https://ci.appveyor.com/project/erblast/easyalluvial)
[![R build status](https://github.com/erblast/easyalluvial/workflows/R-CMD-check/badge.svg)](https://github.com/erblast/easyalluvial/actions)
[![Coverage Status](https://img.shields.io/codecov/c/github/erblast/easyalluvial/master.svg)](https://codecov.io/github/erblast/easyalluvial?branch=master)
[![CRAN last release](https://www.r-pkg.org/badges/last-release/easyalluvial)](https://CRAN.R-project.org/package=easyalluvial)
Expand Down
100 changes: 55 additions & 45 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@

# easyalluvial <a href='https://erblast.github.io/easyalluvial'><img src='man/figures/logo.png' align="right" height="139" /></a>

[![AppVeyor Build
Status](https://ci.appveyor.com/api/projects/status/github/erblast/easyalluvial?branch=master&svg=true)](https://ci.appveyor.com/project/erblast/easyalluvial)
[![R build
status](https://github.com/erblast/easyalluvial/workflows/R-CMD-check/badge.svg)](https://github.com/erblast/easyalluvial/actions)
[![Coverage
Expand Down Expand Up @@ -37,17 +35,17 @@ for data exploration.

## Features

- plot alluvial graph with a single line of code of a given dataframe
- support for wide and long data format [(wiki, wide vs. long/narrow
data)](https://en.wikipedia.org/wiki/Wide_and_narrow_data)
- automatically transforms numerical to categorical data
- helper functions for variable selection
- convenient parameters for coloring and ordering
- marginal histograms
- **model agnostic partial dependence and model response alluvial
plots with 4 dimensions**
- **[interactive plots with `easyalluvial` and
`parcats`](https://erblast.github.io/parcats/articles/parcats.html)**
- plot alluvial graph with a single line of code of a given dataframe
- support for wide and long data format [(wiki, wide vs. long/narrow
data)](https://en.wikipedia.org/wiki/Wide_and_narrow_data)
- automatically transforms numerical to categorical data
- helper functions for variable selection
- convenient parameters for coloring and ordering
- marginal histograms
- **model agnostic partial dependence and model response alluvial plots
with 4 dimensions**
- **[interactive plots with `easyalluvial` and
`parcats`](https://erblast.github.io/parcats/articles/parcats.html)**

## Installation

Expand All @@ -60,19 +58,20 @@ install.packages('easyalluvial')
### Development Version

``` r

# install.packages("devtools")
devtools::install_github("erblast/easyalluvial")
```

## Documentation

- [pkgdown website](https://erblast.github.io/easyalluvial/)
- [Data Exploration with Alluvial
Plots](https://erblast.github.io/easyalluvial/articles/data_exploration.html)
- [Visualising Model
Response](https://erblast.github.io/easyalluvial/articles/model_response.html)
- [Interactive Plots with
parcats](https://erblast.github.io/easyalluvial/articles/parcats.html)
- [pkgdown website](https://erblast.github.io/easyalluvial/)
- [Data Exploration with Alluvial
Plots](https://erblast.github.io/easyalluvial/articles/data_exploration.html)
- [Visualising Model
Response](https://erblast.github.io/easyalluvial/articles/model_response.html)
- [Interactive Plots with
parcats](https://erblast.github.io/easyalluvial/articles/parcats.html)

## Examples

Expand All @@ -86,6 +85,7 @@ suppressPackageStartupMessages( require(easyalluvial) )
#### Sample Data

``` r

knitr::kable( head(mtcars2) )
```

Expand All @@ -102,13 +102,14 @@ knitr::kable( head(mtcars2) )

Continuous Variables will be automatically binned as follows.

- High, High (HH)
- Medium, High (MH)
- Medium (M)
- Medium, Low (ML)
- Low, Low (LL)
- High, High (HH)
- Medium, High (MH)
- Medium (M)
- Medium, Low (ML)
- Low, Low (LL)

``` r

alluvial_wide( data = mtcars2
, max_variables = 5
, fill_by = 'first_variable' )
Expand All @@ -124,18 +125,19 @@ alluvial_wide( data = mtcars2
knitr::kable( head(quarterly_flights) )
```

| tailnum | carrier | origin | dest | qu | mean\_arr\_delay |
|:------------------|:--------|:-------|:-----|:----|:-----------------|
| N0EGMQ LGA BNA MQ | MQ | LGA | BNA | Q1 | on\_time |
| N0EGMQ LGA BNA MQ | MQ | LGA | BNA | Q2 | on\_time |
| N0EGMQ LGA BNA MQ | MQ | LGA | BNA | Q3 | on\_time |
| N0EGMQ LGA BNA MQ | MQ | LGA | BNA | Q4 | on\_time |
| N11150 EWR MCI EV | EV | EWR | MCI | Q1 | late |
| N11150 EWR MCI EV | EV | EWR | MCI | Q2 | late |
| tailnum | carrier | origin | dest | qu | mean_arr_delay |
|:------------------|:--------|:-------|:-----|:----|:---------------|
| N0EGMQ LGA BNA MQ | MQ | LGA | BNA | Q1 | on_time |
| N0EGMQ LGA BNA MQ | MQ | LGA | BNA | Q2 | on_time |
| N0EGMQ LGA BNA MQ | MQ | LGA | BNA | Q3 | on_time |
| N0EGMQ LGA BNA MQ | MQ | LGA | BNA | Q4 | on_time |
| N11150 EWR MCI EV | EV | EWR | MCI | Q1 | late |
| N11150 EWR MCI EV | EV | EWR | MCI | Q2 | late |

#### Plot

``` r

alluvial_long( quarterly_flights
, key = qu
, value = mean_arr_delay
Expand All @@ -159,17 +161,23 @@ alluvial_wide( data = mtcars2
### Interactive Graphs

``` r

suppressPackageStartupMessages( require(parcats) )

p = alluvial_wide(mtcars2, max_variables = 5)

parcats(p, marginal_histograms = TRUE, data_input = mtcars2)
```

![demo](https://raw.githubusercontent.com/erblast/parcats/master/man/figures/demo1.gif)
<figure>
<img
src="https://raw.githubusercontent.com/erblast/parcats/master/man/figures/demo1.gif"
alt="demo" />
<figcaption aria-hidden="true">demo</figcaption>
</figure>

- **[Live
Widget](https://erblast.github.io/parcats/articles/parcats.html)**
- **[Live
Widget](https://erblast.github.io/parcats/articles/parcats.html)**

### Partial Dependence Alluvial Plots

Expand All @@ -190,14 +198,15 @@ in the end. Each of the possible combinations is plotted as a flow which
is coloured by the bin corresponding to the average model response
generated by that particular combination.

- [more on partial dependence plots
(ebook)](https://christophm.github.io/interpretable-ml-book/)
- [Tutorial](https://www.datisticsblog.com/2019/04/visualising-model-response-with-easyalluvial/)
- [more on partial dependence plots
(ebook)](https://christophm.github.io/interpretable-ml-book/)
- [Tutorial](https://www.datisticsblog.com/2019/04/visualising-model-response-with-easyalluvial/)

`easyalluvial` contains wrappers for `parsnip` and `caret` models.
Custom Wrappers for other models can easily be created.

``` r

df = select(mtcars2, -ids)

m = parsnip::rand_forest(mode = "regression") %>%
Expand All @@ -216,11 +225,12 @@ p_grid = add_marginal_histograms(p, df, plot = F) %>%
### Interactive Partial Dependence Plot

``` r

parcats(p, marginal_histograms = TRUE, imp = TRUE, data_input = df)
```

![demo](https://raw.githubusercontent.com/erblast/parcats/master/man/figures/demo2.gif)
- **[Live
![demo](https://raw.githubusercontent.com/erblast/parcats/master/man/figures/demo2.gif) -
**[Live
Widget](https://erblast.github.io/parcats/articles/parcats.html)**

# ClinicoPath {jamovi} Module
Expand All @@ -232,7 +242,7 @@ interface for doing statistics with `R`.

# Similar Packages

- [`ggalluvial`](https://github.com/corybrunson/ggalluvial/)
- [`alluvial`](https://github.com/mbojan/alluvial)
- [`networkD3`](https://github.com/christophergandrud/networkD3)
- [`ggbump`](https://github.com/davidsjoberg/ggbump)
- [`ggalluvial`](https://github.com/corybrunson/ggalluvial/)
- [`alluvial`](https://github.com/mbojan/alluvial)
- [`networkD3`](https://github.com/christophergandrud/networkD3)
- [`ggbump`](https://github.com/davidsjoberg/ggbump)
45 changes: 0 additions & 45 deletions appveyor.yml

This file was deleted.

17 changes: 12 additions & 5 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
# Resubmission after being archived on CRAN

clean up package dependencies
All suggested dependencies were already controlled for, meaning there was a
check in place that would raise an error with a message to install the missing
package. Those are limited to functions most users will not use.

All unit tests would skip if suggested packages were missing.

One example missed a check for a suggested package installation which was added:

- check for vip pkg installation before executing example of alluvial_model_response_parsnip

## Test Environments
* local macOS M1 R 4.2.1
* Appveyor x86_64-w64-mingw32/x64 (64-bit) R 4.2.1
* github actions macos-latest R 4.2.1
* WinBuilder R 4.2.1
* local macOS M1 R 4.3.2
* github actions macos-latest R 4.3.2
* WinBuilder R 4.3.2
* WinBuilder R devel

coverage -> 96 %
Expand Down
Binary file modified man/figures/README-plot_long-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/README-unnamed-chunk-3-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/README-unnamed-chunk-5-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/README-wide_plot-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions man/get_data_space.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading