我一直在开发一个闪亮的应用程序,希望将其集成到golem框架中。我使用了shinyFiles package中的目录选择器,但是尝试对其进行模块化时遇到了一些问题(闪亮的应用程序不再显示我的目录了)。不得不说我是闪亮的应用程序开发的初学者。任何建议都将受到高度赞赏:
#' datadir UI Function
#'
#' @description A shiny Module.
#'
#' @param id,input,output,session Internal parameters for {shiny}.
#'
#' @noRd
#'
#' @importFrom shiny NS tagList
mod_datadir_ui <- function(id){
ns <- NS(id)
tagList(
shinyDirButton("datadir","Raw data directory","Please select the folder containing the raw accelerometer data")
)
}
#' datadir Server Function
#'
#' @noRd
mod_datadir_server <- function(input,session){
ns <- session$ns
volumes <- c(Home = fs::path_home(),"R Installation" = R.home(),getVolumes()())
# DATADIR
shinyDirChoose(input,"datadir",roots = volumes,session = session,restrictions = system.file(package = "base"))
}
## To be copied in the UI
# mod_datadir_ui("datadir_ui_1")
## To be copied in the server
# callModule(mod_datadir_server,"datadir_ui_1")