Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何从ShinyFiles上传RData_R_Shiny - Fatal编程技术网

如何从ShinyFiles上传RData

如何从ShinyFiles上传RData,r,shiny,R,Shiny,我想用ShinyFile上传RData文件,但我不知道怎么做 这对我不起作用: library(shiny) library(shinydashboard) library(shinyFiles) # Define UI for application that draws a histogram ui <- dashboardPage( dashboardHeader(), dashboardSidebar(), dashboardBody( shinyFile

我想用ShinyFile上传RData文件,但我不知道怎么做

这对我不起作用:

library(shiny)
library(shinydashboard)
library(shinyFiles)



# Define UI for application that draws a histogram
ui <- dashboardPage(
  dashboardHeader(),
  dashboardSidebar(),
  dashboardBody(
    shinyFilesButton('files', label='File select', title='Please select a file', multiple=FALSE),

    verbatimTextOutput("txt")
  )
)



# Define server logic required to draw a histogram
server <- function(input, output) {

  shinyFileChoose(input, 'files', root=c(root='/'), filetypes=c('', 'RData'))
  output$txt <- renderPrint(
    ls(parseFilePaths(roots= "/",selection = input$files))
  )



}

# Run the application 
shinyApp(ui = ui, server = server)
库(闪亮)
图书馆(shinydashboard)
图书馆(shinyFiles)
#为绘制直方图的应用程序定义UI

ui我已经解决了它。这里是解决方案(希望对其他人有所帮助)

#为绘制直方图的应用程序定义UI

ui我用保存在本地机器硬盘上的文件尝试了这个。
load
函数返回一条错误消息:
警告:gzfile中出错:“description”参数无效
。我不知道是否可以对本地文件使用
shinyFileChoose
files< - load(parseFilePaths(roots= "/",selection = input$files)$type)
# Define UI for application that draws a histogram
ui <- dashboardPage(
  dashboardHeader(),
  dashboardSidebar(),
  dashboardBody(
    shinyFilesButton('files', 'File select', 'Please select a file', FALSE),
    verbatimTextOutput('filepaths')
  )
)



# Define server logic required to draw a histogram
server <- function(input, output) {
  roots = c(wd='/home/developer/')


  reactivity <- reactive({ 
    shinyFileChoose(input, 'files', roots=roots, filetypes=c('', 'RData'))
    ruta <- parseFilePaths(roots, input$files)$datapath
    load(ruta)
    return(parseFilePaths(roots, input$files))
    })

  output$filepaths <- renderPrint({

 reactivity()

    })



}

# Run the application 
shinyApp(ui = ui, server = server)