|
1 | 1 | #' @include utils.R |
2 | 2 | NULL |
3 | 3 |
|
4 | | -#' Run imagefluency app |
| 4 | +#' Interactive dashboard for \code{imagefluency} |
5 | 5 | #' |
6 | | -#' Launches a Shiny app that shows a demo of what can be done with |
7 | | -#' the \code{imagefluency} package. |
| 6 | +#' Launches a dashboard to interactively use the functions of the |
| 7 | +#' \code{imagefluency} package. The dashboard is built using the \code{shiny} |
| 8 | +#' package and provides a user-friendly interface for uploading images, |
| 9 | +#' analyzing them, and exporting the results. The dashboard supports |
| 10 | +#' multi-image uploads and side-by-side comparisons of image fluency scores. |
| 11 | +#' |
| 12 | +#' @param max_images Integer. Maximum number of images that can be uploaded. |
| 13 | +#' Defaults to 100. |
8 | 14 | #' |
9 | 15 | #' @export |
10 | 16 | #' |
|
13 | 19 | #' ## Only run this example in interactive R sessions |
14 | 20 | #' if (interactive()) { |
15 | 21 | #' run_imagefluency() |
| 22 | +#' |
| 23 | +#' # increase the maximum number of uploadable images to 150 |
| 24 | +#' run_imagefluency(max_images = 150) |
16 | 25 | #' } |
17 | | -run_imagefluency <- function() { |
| 26 | +run_imagefluency <- function(max_images = 100) { |
18 | 27 | appDir <- system.file("imagefluencyApp", package = "imagefluency") |
19 | 28 | if (appDir == "") { |
20 | 29 | stop("Could not find shiny app directory. Try re-installing `imagefluency`.", call. = FALSE) |
21 | 30 | } |
22 | 31 |
|
| 32 | + if (!is.numeric(max_images) || max_images < 1) { |
| 33 | + stop("`max_images` must be a positive number.", call. = FALSE) |
| 34 | + } |
| 35 | + |
23 | 36 | if (requireNamespace("shiny", quietly = TRUE)) { |
| 37 | + options(imagefluency.max_images = as.integer(max_images)) |
| 38 | + on.exit(options(imagefluency.max_images = NULL), add = TRUE) |
24 | 39 | shiny::runApp(appDir, display.mode = "normal") |
25 | 40 | } else { |
26 | 41 | stop("Package 'shiny' is required but not installed on your system.", call. = FALSE) |
|
0 commit comments