R/run_skleid.R

##' launch shiny app
##'
##'
##' @title run_skleid
##' @return NULL
##' @importFrom shiny runApp
##' @import shinyFiles
##' @export
##' @author Guangchuang Yu
run_skleid <- function() {
    pkg <- "shinyFiles"
    require(pkg, character.only=TRUE)
    dir <- system.file("app", package="skleid")
    options(shiny.launch.browser = TRUE)
    runApp(dir)
}


##' generate desktop shortcut
##'
##'
##' @title generate_run_skleid_app
##' @return NULL
##' @export
##' @author Guangchuang Yu
generate_run_skleid_app <- function() {
    os <- Sys.info()[["sysname"]]
    if (os != "Windows") {
        stop("This function only works in Windows Platform...")
    }

    ## outfile <- paste0(file.path(Sys.getenv("USERPROFILE"), "Desktop"), "/run_skleid.bat")
    ## outfile <- gsub("/", "\\\\", outfile)
    ## out <- file(outfile, "w")
    out <- file("c:\\run_skleid.bat", "w")
    writeLines(sub('library/base', 'bin/Rscript -e "skleid::run_skleid()"', system.file(package="base")), out)
    close(out)
}
GuangchuangYu/skleid documentation built on May 6, 2019, 9:03 p.m.