我正在使用Shinydashboard构建一个闪亮的应用程序,该应用程序将部署在Shinyproxy服务器上,但我希望客户端能够浏览自己的文件(客户端)并在选定目录中加载文件
我正在使用这篇文章:Interactive directory input in Shiny app (R)
但是答案是发亮的,而不是发亮的仪表板,这就是我到目前为止所得到的:
header <- dashboardHeader()
sidebar <- dashboardSidebar(
tags$head(tags$script(src="./www/text.js")),
sidebarUserPanel("Panelado variantes",
subtitle = a(href = "#", icon("circle", class = "text-success"), "Online"),
# Image file should be in www/ subdir
image = "logoGMX-color.jpg"
# image = "https://vignette.wikia.nocookie.net/fanfictiondisney/images/9/9e/Pumba_3.j pg/revision/latest?cb=20120708163413"
),
hr(),
sidebarMenu(
# Setting id makes input$tabs give the tabName of currently-selected tab
id = "tabs",
menuItem("Archivo variantes", tabName = "filelist", icon = icon("table"),
tags$div(class="form-group shiny-input-container",
tags$div(tags$label("File input")),
tags$div(tags$label("Choose folder", class="btn btn-primary",
tags$input(id = "fileIn", webkitdirectory = TRUE, type = "file", style="display: none;", onchange="pressed()"))),
tags$label("No folder choosen", id = "noFile"),
tags$div(id="fileIn_progress", class="progress progress-striped active shiny-file-input-progress",
tags$div(class="progress-bar"))
)
)
)
)
body <- dashboardBody(
tags$style(type="text/css",
".shiny-output-error { visibility: hidden; }",
".shiny-output-error:before { visibility: hidden; }",
".shiny-output-error:after { visibility: hidden; }"),
tags$head(HTML("<script type='text/javascript' src='getFolders.js'></script>")),
#ui
shinyjs::useShinyjs(),
tabItems(
tabItem(tabName="filelist", "lista de archvivos",
fluidRow(
column(12,
DT::dataTableOutput("tabla_files")))
)
)
)
ui <- dashboardPage(header, sidebar, body)
server = function(input, output) {
options(shiny.maxRequestSize=100*1024^2)
df <- reactive({
inFiles <- input$fileIn
print(inFiles)
print(inFiles$name)
df <- data.frame()
if (is.null(inFiles))
return(NULL)
for (i in seq_along(inFiles$datapath)) {
tmp <- read.csv(inFiles$datapath[i], header = FALSE)
df <- rbind(df, tmp)
}
df
})
output$tabla_files <- DT::renderDataTable(
input$fileIn
)
}
runApp(list(ui = ui, server = server), launch.browser =T)
我可以打开对话框浏览文件,但是上传文件时,我在桌上看不到任何输出
有什么想法吗?