From 6fbe1f759992f942ff7b6bc2d9e8c66a54493e45 Mon Sep 17 00:00:00 2001 From: Stefan Mayer Date: Tue, 20 Feb 2024 20:39:54 +0100 Subject: [PATCH] Disable complexity/simplicity examples (for now) under Windows to fix CRAN issues (long execution times due to R.utils()). And fix some typos. --- R/complexity.R | 2 +- R/imagefluencyApp.R | 6 ++---- R/simplicity.R | 8 ++++---- man/img_complexity.Rd | 3 ++- man/img_simplicity.Rd | 9 +++++---- man/run_imagefluency.Rd | 6 +++--- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/R/complexity.R b/R/complexity.R index 9155703..3c947a6 100644 --- a/R/complexity.R +++ b/R/complexity.R @@ -50,7 +50,7 @@ NULL #' uncompressed image file size #' @export #' -#' @examples +#' @examplesIf .Platform$OS.type != "windows" #' # Example image with high complexity: trees #' trees <- img_read(system.file("example_images", "trees.jpg", package = "imagefluency")) #' # diff --git a/R/imagefluencyApp.R b/R/imagefluencyApp.R index 217e109..5734f00 100644 --- a/R/imagefluencyApp.R +++ b/R/imagefluencyApp.R @@ -9,11 +9,9 @@ NULL #' @export #' #' -#' @examples +#' @examplesIf interactive() #' ## Only run this example in interactive R sessions -#' if (interactive()) { -#' run_imagefluency() -#' } +#' run_imagefluency() run_imagefluency <- function() { appDir <- system.file("imagefluencyApp", package = "imagefluency") if (appDir == "") { diff --git a/R/simplicity.R b/R/simplicity.R index bb9cae6..09a64c6 100644 --- a/R/simplicity.R +++ b/R/simplicity.R @@ -9,7 +9,7 @@ NULL #' @details Image simplicity is calculated as 1 minus the ratio between the #' compressed and uncompressed file size (i.e., the compression rate). Values #' can range between 0 (no compression possible, thus extremely complex image) -#' and almost 1 (virtually completely compressed image, thus extremly simple +#' and almost 1 (virtually completely compressed image, thus extremely simple #' image). Different compression algorithms are implemented. For details, see #' \code{\link{img_complexity}}. #' @@ -27,14 +27,14 @@ NULL #' uncompressed file size (i.e., the compression rate) #' @export #' -#' @examples +#' @examplesIf .Platform$OS.type != "windows" #' # Example image with low simplicity: trees #' trees <- img_read(system.file("example_images", "trees.jpg", package = "imagefluency")) #' # #' # display image #' grid::grid.raster(trees) #' # -#' # get complexity +#' # get simplicity #' img_simplicity(trees) #' #' # Example image with high simplicity: sky @@ -43,7 +43,7 @@ NULL #' # display image #' grid::grid.raster(sky) #' # -#' # get complexity +#' # get simplicity #' img_simplicity(sky) #' #' @references Donderi, D. C. (2006). Visual complexity: A Review. diff --git a/man/img_complexity.Rd b/man/img_complexity.Rd index 690169e..4db2703 100644 --- a/man/img_complexity.Rd +++ b/man/img_complexity.Rd @@ -59,6 +59,7 @@ The function returns the visual complexity of an image. Visual to write (and read) images. } \examples{ +\dontshow{if (.Platform$OS.type != "windows") (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # Example image with high complexity: trees trees <- img_read(system.file("example_images", "trees.jpg", package = "imagefluency")) # @@ -77,7 +78,7 @@ grid::grid.raster(sky) # # get complexity img_complexity(sky) - +\dontshow{\}) # examplesIf} } \references{ Donderi, D. C. (2006). Visual complexity: A Review. diff --git a/man/img_simplicity.Rd b/man/img_simplicity.Rd index 84d54de..048512b 100644 --- a/man/img_simplicity.Rd +++ b/man/img_simplicity.Rd @@ -31,18 +31,19 @@ complexity of the image. Higher values indicated higher image simplicity. Image simplicity is calculated as 1 minus the ratio between the compressed and uncompressed file size (i.e., the compression rate). Values can range between 0 (no compression possible, thus extremely complex image) - and almost 1 (virtually completely compressed image, thus extremly simple + and almost 1 (virtually completely compressed image, thus extremely simple image). Different compression algorithms are implemented. For details, see \code{\link{img_complexity}}. } \examples{ +\dontshow{if (.Platform$OS.type != "windows") (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # Example image with low simplicity: trees trees <- img_read(system.file("example_images", "trees.jpg", package = "imagefluency")) # # display image grid::grid.raster(trees) # -# get complexity +# get simplicity img_simplicity(trees) # Example image with high simplicity: sky @@ -51,9 +52,9 @@ sky <- img_read(system.file("example_images", "sky.jpg", package = "imagefluency # display image grid::grid.raster(sky) # -# get complexity +# get simplicity img_simplicity(sky) - +\dontshow{\}) # examplesIf} } \references{ Donderi, D. C. (2006). Visual complexity: A Review. diff --git a/man/run_imagefluency.Rd b/man/run_imagefluency.Rd index 3961f3f..6aac2cd 100644 --- a/man/run_imagefluency.Rd +++ b/man/run_imagefluency.Rd @@ -11,8 +11,8 @@ Launches a Shiny app that shows a demo of what can be done with the \code{imagefluency} package. } \examples{ +\dontshow{if (interactive()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} ## Only run this example in interactive R sessions -if (interactive()) { - run_imagefluency() -} +run_imagefluency() +\dontshow{\}) # examplesIf} }