4
是否有可能鏈接R閃亮中的選擇輸入控件。我目前有一個下拉菜單來顯示目錄中的文件夾。我想要第二個下拉菜單來顯示所選文件夾中的文件。可能嗎?R中的鏈接SelectInput控件Shiny - 是否有可能?
這裏是ui.R:
shinyUI(pageWithSidebar(
sidebarPanel(
selectInput("Folder", "Folder:" , as.matrix(getFolders()),multiple = TRUE)
selectInput("FileInFolder", "File in folder:") # can this dropdown be linked to one above???
),
mainPanel(
))#end main
)
這裏是server.R
shinyServer(function(input, output) {})
下面是代碼來運行它:
library(shiny)
runApp("C:/Users/me/Desktop/R Projects/FileFolder")
這是我的世界。 R文件填充文件夾:
getFolders<-function()
{
folders<-list.dirs("//nas/mypath/",full.names= FALSE,recursive = FALSE)
folders
}
這裏是一個有趣的##我怎樣才能把他連接到getFolders,這樣UI是級聯的?
getFilesInFolder<-function(Folder)
{
files<-list.files(paste("//nas/mypath/",Folder,sep=""))
files
}
任何想法如何使這個工作,使UI是層疊。那就是當你從文件夾下拉菜單中選擇一個文件夾時,文件下拉列表被更新了?
謝謝。