Closed majkamichal closed 1 year ago
The airship()
function should guide the user in case of missing dependencies.
If some dependencies are missing then the app is not started. Instead, install.packages("")
command is generated.
dependencies <- c("ggplot2", "shinyjs", "shinyAce", "shinyBS", "shinythemes", "Cairo", "DT", "colourpicker")
ind_missing_package <- !dependencies %in% utils::installed.packages()[ ,"Package"]
if (any(ind_missing_package)) { n_missing_packages <- sum(ind_missing_package) stop("Please install ", ifelse(n_missing_packages == 1, "the", "these"), " missing package", ifelse(n_missing_packages > 1, "s", ""), ":\n ", "install.packages(", ifelse(n_missing_packages > 1, "c(", ""), paste0("\"", dependencies[ind_missing_package], collapse = "\", "), ifelse(n_missing_packages > 1, "\"))", "\")")) }
Even if all dependencies were installed during the package installation process it could easily happen that a user removed some dependency (even by chance) and the app would crash.
Code was slightly adjusted.
dependencies <- c( "shiny", "DT", "shinybusy", "plotly", "dplyr", "tidyselect", "tidyr", "stringr", "shinyBS", "colourpicker", "shinyWidgets", "shinydashboard", "scales", "Cairo", "ggplot2", "rlang", "magrittr" )
ind_missing_package <- !dependencies %in% utils::installed.packages()[ ,"Package"]
if (any(ind_missing_package)) { n_missing_packages <- sum(ind_missing_package) stop( "Some dependencies are missing. Please install ", ifelse( n_missing_packages == 1, "the", "these" ), " missing package", ifelse( n_missing_packages > 1, "s", "" ), " by running :\n ", "install.packages(", ifelse( n_missing_packages > 1, "c('", "'" ), paste0( "", dependencies[ind_missing_package], collapse = "','" ), ifelse( n_missing_packages > 1, "'))", "')" ) ) }
See: https://github.com/majkamichal/easyPlot/issues/3