R/app_utils.R

Defines functions get_ships_options app_sys

Documented in app_sys get_ships_options

#' Access files in the current app
#'
#' @param ... Character vector specifying directory and or file to
#'     point to inside the current package.
#'
#' @export
app_sys <- function(...){
    system.file(..., package = "ships")
}


#' Get all or one ships options
#'
#' This function is to be used inside the
#' server and UI from your app, in order to call the
#' parameters passed to \code{run_app()}.
#'
#' @param which NULL (default), or the name of an option
#' @importFrom shiny getShinyOption
#' @export
get_ships_options <- function(which = NULL){

    if (is.null(which)){
        getShinyOption("runtime_options")
    } else {
        if (length(which)>1){
            unlist(getShinyOption("runtime_options")[which])
        }
        else{
            getShinyOption("runtime_options")[[which]]
        }
    }
}
siddbhatia/ships documentation built on Dec. 23, 2021, 2:20 a.m.