Skip to content

Commit

Permalink
Merge pull request #28 from erblast/issue26
Browse files Browse the repository at this point in the history
Issue26
  • Loading branch information
erblast authored Jul 9, 2022
2 parents b628066 + 3bc2b7c commit df22644
Show file tree
Hide file tree
Showing 24 changed files with 188 additions and 208 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@
^tests/figs$
^\.github$
^README.md$
^CRAN-SUBMISSION$
3 changes: 3 additions & 0 deletions .github/workflows/articles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ jobs:
install.packages(c("remotes", "devtools", "tidyverse", "pkgdown"))
remotes::install_deps(dependencies = TRUE)
devtools::install()
system("git clone https://github.com/erblast/parcats.git")
remotes::install_deps("parcats/", dependencies = TRUE)
devtools::install("parcats/")
shell: Rscript {0}
- name: Check
run: |
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ jobs:
remotes::install_deps(dependencies = TRUE)
install.packages("tidyverse")
install.packages("pkgdown", type = "binary")
system("git clone https://github.com/erblast/parcats.git")
remotes::install_deps("parcats/", dependencies = TRUE)
devtools::install("parcats/")
shell: Rscript {0}

- name: Install package
Expand All @@ -46,4 +49,4 @@ jobs:
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Actions"
Rscript -e 'pkgdown::deploy_to_branch(new_process = FALSE)'
Rscript -e 'pkgdown::deploy_to_branch(new_process = FALSE, run_dont_run = FALSE)'
83 changes: 0 additions & 83 deletions .travis.yml

This file was deleted.

5 changes: 2 additions & 3 deletions 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.0
Version: 0.3.1
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 All @@ -26,7 +26,6 @@ Suggests:
ISLR,
nycflights13,
vdiffr (>= 0.3.1),
parcats,
pkgdown,
mlbench,
earth,
Expand All @@ -40,7 +39,7 @@ Suggests:
rpart,
glmnet,
xgboost
RoxygenNote: 7.1.1
RoxygenNote: 7.2.0
Imports:
purrr
, tidyr (>= 1.0.0)
Expand Down
5 changes: 4 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Version 0.3.1 submitted to CRAN 20220704
- cleanup package dependencies

# Version 0.3.0 submitted to CRAN 20200111
- moved modeling packages and vdiffr from imports to suggests
- added parsnip and workflows wrapper
Expand Down Expand Up @@ -33,7 +36,7 @@ Bug Fixes:
- Compatibility with `recipes 0.1.5`
- NA values in numerical columns are excepted
- correct ggplot2 and ggalluvial versions added as dependencies
- p$data_key does not contain comlumns with empty levels anyomore
- p$data_key does not contain columns with empty levels anymore
- better support for numerical variables for alluvial_long()

# Version: 0.1.8, submitted to CRAN 20190115
Expand Down
3 changes: 1 addition & 2 deletions R/alluvial_long.R
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,11 @@
#' ,\code{\link[easyalluvial]{manip_bin_numerics}}
#' @examples
#'
#'
#' \dontrun{
#' data = quarterly_flights
#'
#' alluvial_long( data, key = qu, value = mean_arr_delay, id = tailnum, fill_by = 'last_variable' )
#'
#' \dontrun{
#' # more flow coloring variants ------------------------------------
#'
#' alluvial_long( data, key = qu, value = mean_arr_delay, id = tailnum, fill_by = 'first_variable' )
Expand Down
21 changes: 13 additions & 8 deletions R/alluvial_model_response.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

#' @noRd
check_degree = function(degree, imp, df){

if( degree > nrow(imp) ){
Expand All @@ -11,24 +11,25 @@ check_degree = function(degree, imp, df){

#' @title check if package is installed
#' @param pkg character, package name
#' @param raise_error logical
#' @return logical
#' @export
#' @rdname check_pkg_installed
#' @examples
#' check_pkg_installed("easyalluvial")
#'
check_pkg_installed = function(pkg){
check_pkg_installed = function(pkg, raise_error = TRUE){

is_installed <- try({
suppressPackageStartupMessages(requireNamespace(pkg, quietly = TRUE))
})

msg <- paste("Please install package `", pkg, "`")

if(! is_installed){
if(! is_installed & raise_error){
stop(msg)
}

return(TRUE)
return(is_installed)
}

#' @title pretty numbers
Expand Down Expand Up @@ -526,6 +527,7 @@ get_pdp_predictions_seq = function(df, imp, m, degree = 4, bins = 5, .f_predict
#'@param parallel logical, Default: TRUE
#'@rdname pdp_predictions
#'@seealso \code{\link[easyalluvial]{get_pdp_predictions}}
#' @noRd
pdp_predictions = function(df, imp, m, degree = 4, bins = 5, .f_predict = predict,
parallel = FALSE){

Expand All @@ -551,6 +553,9 @@ pdp_predictions = function(df, imp, m, degree = 4, bins = 5, .f_predict = predic
return(pred)
}

# we add one call to progress to satisfy R CMD check
.f <- progress::progress_bar

progressr::handlers("progress")
along <- seq(1, nrow(df))

Expand Down Expand Up @@ -963,7 +968,7 @@ alluvial_model_response = function(pred, dspace, imp, degree = 4
#' Analysis and Data Mining 8(4) <doi:10.1002/sam.11271>
#' @examples
#'
#' if(check_pkg_installed("caret")) {
#' if(check_pkg_installed("caret", raise_error = FALSE)) {
#' df = mtcars2[, ! names(mtcars2) %in% 'ids' ]
#'
#' train = caret::train( disp ~ .,
Expand Down Expand Up @@ -1068,7 +1073,7 @@ alluvial_model_response_caret = function(train, data_input, degree = 4, bins = 5
#' observation in the training data the displayed variables are set to the
#' indicated values. The predict function is called for each modified
#' observation and the result is averaged} }. Default: 'median'
#'@param parallel logical, turn on parallel processing for pdp methof. Default: FALSE
#'@param parallel logical, turn on parallel processing for pdp method. Default: FALSE
#'@param params_bin_numeric_pred list, additional parameters passed to
#' \code{\link[easyalluvial]{manip_bin_numerics}} which is applied to the pred
#' parameter. Default: list(bins = 5, center = T, transform = T, scale = T)
Expand All @@ -1090,7 +1095,7 @@ alluvial_model_response_caret = function(train, data_input, degree = 4, bins = 5
#'@inheritSection get_pdp_predictions Parallel Processing
#' @examples
#'
#' if(check_pkg_installed("parsnip")) {
#' if(check_pkg_installed("parsnip", raise_error = FALSE)) {
#' df = mtcars2[, ! names(mtcars2) %in% 'ids' ]
#'
#' m = parsnip::rand_forest(mode = "regression") %>%
Expand Down
7 changes: 3 additions & 4 deletions R/alluvial_wide.R
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,10 @@ if(getRversion() >= "2.15.1"){
#' name the order will be the same. If we want to change level order
#' independently we have to assign unique level names first.
#' @examples
#' alluvial_wide( data = mtcars2, id = ids
#' , max_variables = 5
#' , fill_by = 'first_variable' )
#'\dontrun{
#'
#' alluvial_wide( data = mtcars2, id = ids
#' , max_variables = 3
#' , fill_by = 'first_variable' )#'
#' # more coloring variants----------------------
#' alluvial_wide( data = mtcars2, id = ids
#' , max_variables = 5
Expand Down
8 changes: 6 additions & 2 deletions R/plot_marginal_hist.R
Original file line number Diff line number Diff line change
Expand Up @@ -511,8 +511,10 @@ plot_hist_wide = function( var, p, data_input){
#' inferred, Default: NULL } }
#'@return gtable
#' @examples
#' p = alluvial_wide(mtcars2, max_variables = 4)
#'\dontrun{
#' p = alluvial_wide(mtcars2, max_variables = 3)
#' p_grid = add_marginal_histograms(p, mtcars2)
#'}
#'@seealso \code{\link[gridExtra]{arrangeGrob}}
#'@rdname add_marginal_histograms
#'@export
Expand Down Expand Up @@ -574,8 +576,10 @@ add_marginal_histograms = function(p, data_input, top = TRUE, keep_labels = FALS
#' can be used to pass training predictions for model response alluvials
#' @return gtable
#' @examples
#' p = alluvial_wide(mtcars2, max_variables = 4)
#'\dontrun{
#' p = alluvial_wide(mtcars2, max_variables = 3)
#' plot_all_hists(p, mtcars2)
#' }
#' @seealso \code{\link[gridExtra]{arrangeGrob}}
#' @seealso \code{\link[easyalluvial]{add_marginal_histograms}}
#' @rdname plot_all_hists
Expand Down
1 change: 1 addition & 0 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ reference:
contents:
- starts_with("manip_")
- tidy_imp
- check_pkg_installed
- title: Helper Functions - Plotting
desc: ~
contents:
Expand Down
49 changes: 12 additions & 37 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,50 +1,25 @@
# Resubmission 0.3.0 - 3
# Resubmission after being archived on CRAN

Got one Note from automated CRAN check that tests are too slow.
Overall checktime 12 min > 10 min

Disabled a few more tests on CRAN

# Resubmission 0.3.0 - 2

Got one Note from automated CRAN check that tests are too slow.
Disabled some none-essential longer running tests for CRAN

# Resubmission 0.3.0 - 1

For some reasons 'caret' did not install on the Windows Server which ran
the automated CRAN checks.

Since 'caret' is only in Suggests, the examples will now only execute if 'caret'
is installed.

# Update 0.3.0

vdiffr and other packages moved to suggests and usage was made conditional
clean up package dependencies

## Test Environments
* local macOS 10.14.6 R 4.0.3
* Appveyor x86_64-w64-mingw32/x64 (64-bit) R 4.0.3
* github actions macos-latest R 4.0.3
* Rhub Fedora Linux, R-devel, clang, gfortran
* Rhub Ubuntu Linux 16.04 LTS, R-release, GCC --> NOTE
* Rhub Windows Server 2008 R2 SP1, R-devel, 32/64 bit
* WinBuilder R 4.0.3
* 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
* WinBuilder R devel

coverage -> 96 %


## Test Results

No errors or notes except for:
5 Examples with CPU or elapsed time > 5s
This server seem to be a bit slower than the others.
The examples are already pretty minimal and have been around for a while.
I would prefer to keep them and not put them into \dontrun{}.
Maintainer: ‘Bjoern Koneswarakantha <[email protected]>

New submission

Package was archived on CRAN

## Reverse Dependencies

This package has one reverse dependency 'parcats'
- which is also maintained by me
- all checks are passing
no reverse dependencies
Loading

0 comments on commit df22644

Please sign in to comment.