From 120044c428a067ced757c7fd213e26c667097190 Mon Sep 17 00:00:00 2001 From: Bjoern Koneswarakantha Date: Fri, 8 Dec 2023 16:34:03 +0100 Subject: [PATCH] fix examples and docs --- NEWS.md | 2 ++ R/parcats.R | 23 +++++++++++++---------- cran-comments.md | 24 ++++++++++++++++++++++++ man/parcats-shiny.Rd | 3 +++ man/parcats.Rd | 20 +++++++++++--------- man/parcats_demo.Rd | 3 +++ 6 files changed, 56 insertions(+), 19 deletions(-) diff --git a/NEWS.md b/NEWS.md index 7583306..c58fd91 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,7 @@ # parcats 0.0.5 * update vignette +* fix documentation +* fix examples # parcats 0.0.4 * updated package dependencies diff --git a/R/parcats.R b/R/parcats.R index 34f8a82..1d4eaf5 100644 --- a/R/parcats.R +++ b/R/parcats.R @@ -580,7 +580,7 @@ get_shapes = function(traces){ #'@details most parameters are best left at default values #' @examples #' -#'\dontrun{ +#'\donttest{ #'library(easyalluvial) #' #' # alluvial wide --------------------------------- @@ -590,15 +590,17 @@ get_shapes = function(traces){ #' #' parcats(p, marginal_histograms = TRUE, data_input = mtcars2) #' -#' # alluvial for model response -------------------- -#' df = mtcars2[, ! names(mtcars2) %in% 'ids' ] -#' m = randomForest::randomForest( disp ~ ., df) -#' imp = m$importance -#' dspace = get_data_space(df, imp, degree = 3) -#' pred = predict(m, newdata = dspace) -#' p = alluvial_model_response(pred, dspace, imp, degree = 3) +#' if(check_pkg_installed("randomForest", raise_error = FALSE)) { +#' # alluvial for model response -------------------- +#' df = mtcars2[, ! names(mtcars2) %in% 'ids' ] +#' m = randomForest::randomForest( disp ~ ., df) +#' imp = m$importance +#' dspace = get_data_space(df, imp, degree = 3) +#' pred = predict(m, newdata = dspace) +#' p = alluvial_model_response(pred, dspace, imp, degree = 3) #' -#' parcats(p, marginal_histograms = TRUE, imp = TRUE, data_input = df) +#' parcats(p, marginal_histograms = TRUE, imp = TRUE, data_input = df) +#' } #'} #' #'@seealso \code{\link[easyalluvial]{alluvial_wide}} @@ -776,7 +778,7 @@ parcats <- function(p, marginal_histograms = TRUE, data_input = NULL #' is useful if you want to save an expression in a variable. #' #' @name parcats-shiny -#' +#' @return No return value, called for side effects #' @export parcatsOutput <- function(outputId, width = '100%', height = '100%', inline = FALSE){ htmlwidgets::shinyWidgetOutput(outputId @@ -804,6 +806,7 @@ render_parcats <- function(expr, env = parent.frame(), quoted = FALSE) { #' } #' @rdname parcats_demo #' @export +#' @return No return value, called for side effects parcats_demo <- function() { easyalluvial::check_pkg_installed("shiny") diff --git a/cran-comments.md b/cran-comments.md index e939883..f39ae31 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -1,3 +1,27 @@ +# Resubmission + + +Please add \value to .Rd files regarding exported methods and explain +the functions results in the documentation. Please write about the +structure of the output (class) and also what the output means. (If a +function does not return a value, please document that too, e.g. +\value{No return value, called for side effects} or similar) +Missing Rd-tags: + parcats-shiny.Rd: \value + parcats_demo.Rd: \value + +\dontrun{} should only be used if the example really cannot be executed +(e.g. because of missing additional software, missing API keys, ...) by +the user. That's why wrapping examples in \dontrun{} adds the comment +("# Not run:") as a warning for the user. Does not seem necessary. +Please replace \dontrun with \donttest. +Please unwrap the examples if they are executable in < 5 sec, or replace +dontrun{} with \donttest{}. +-> man/parcats.Rd + +- return value was added +- switched to donttest +- conditional execution of parcats example that requires suggested package # parcats 0.0.5 Resubmit to CRAN after being archived. diff --git a/man/parcats-shiny.Rd b/man/parcats-shiny.Rd index 0d258b4..53cf341 100644 --- a/man/parcats-shiny.Rd +++ b/man/parcats-shiny.Rd @@ -26,6 +26,9 @@ string and have \code{'px'} appended.} \item{quoted}{Is \code{expr} a quoted expression (with \code{quote()})? This is useful if you want to save an expression in a variable.} } +\value{ +No return value, called for side effects +} \description{ Output and render functions for using parcats within Shiny applications and interactive Rmd documents. diff --git a/man/parcats.Rd b/man/parcats.Rd index 8f79d30..b3eb43f 100644 --- a/man/parcats.Rd +++ b/man/parcats.Rd @@ -88,7 +88,7 @@ most parameters are best left at default values } \examples{ -\dontrun{ +\donttest{ library(easyalluvial) # alluvial wide --------------------------------- @@ -98,15 +98,17 @@ parcats(p, marginal_histograms = FALSE) parcats(p, marginal_histograms = TRUE, data_input = mtcars2) -# alluvial for model response -------------------- -df = mtcars2[, ! names(mtcars2) \%in\% 'ids' ] -m = randomForest::randomForest( disp ~ ., df) -imp = m$importance -dspace = get_data_space(df, imp, degree = 3) -pred = predict(m, newdata = dspace) -p = alluvial_model_response(pred, dspace, imp, degree = 3) +if(check_pkg_installed("randomForest", raise_error = FALSE)) { + # alluvial for model response -------------------- + df = mtcars2[, ! names(mtcars2) \%in\% 'ids' ] + m = randomForest::randomForest( disp ~ ., df) + imp = m$importance + dspace = get_data_space(df, imp, degree = 3) + pred = predict(m, newdata = dspace) + p = alluvial_model_response(pred, dspace, imp, degree = 3) -parcats(p, marginal_histograms = TRUE, imp = TRUE, data_input = df) + parcats(p, marginal_histograms = TRUE, imp = TRUE, data_input = df) +} } } diff --git a/man/parcats_demo.Rd b/man/parcats_demo.Rd index 30d8916..d0e39da 100644 --- a/man/parcats_demo.Rd +++ b/man/parcats_demo.Rd @@ -6,6 +6,9 @@ \usage{ parcats_demo() } +\value{ +No return value, called for side effects +} \description{ run parcats shiny demo }