R/polaroid.R

Defines functions polaroid

Documented in polaroid

#' @title polaroid
#'
#' @description run polaroid shiny application in appDir
#' @seealso https://github.com/jhk0530/polaroid
#'
#' @examples if (interactive()) {
#'   polaroid()
#' }
#'
#' @import shiny
#' @return None
#'
#' @export
#'

polaroid <- function() {
  required_pkgs <- c("argonDash", "argonR", "colourpicker", "hexSticker",
                     "htmltools", "magick", "shinyjs", "showtext",
                     "stringr", "sysfonts")

  missing_pkgs <- required_pkgs[!vapply(required_pkgs, requireNamespace, logical(1), quietly = TRUE)]

  if (length(missing_pkgs) > 0) {
    stop(
      paste("Please install missing packages:", paste(missing_pkgs, collapse = ", ")),
      call. = FALSE
    )
  }

  appDir <- system.file("polaroid", package = "polaroid")
  if (appDir == "") {
    stop("Could not find Directory, Try re-install", call. = FALSE)
  }

  shiny::runApp(
    appDir,
    launch.browser = TRUE,
    display.mode = "normal"
  )
}

Try the polaroid package in your browser

Any scripts or data that you put into this service are public.

polaroid documentation built on April 3, 2025, 5:28 p.m.