简体   繁体   English

R闪亮:文件错误(文件,“ rt”):无效的“描述”参数

[英]R shiny: Error in file(file, “rt”) : invalid 'description' argument

I am getting a very common error as the title indicates. 如标题所示,我遇到了一个非常常见的错误。 However, it is in my shiny app and I don't know what's going on. 但是,它在我闪亮的应用程序中,我不知道发生了什么。

I have a input file that has a list of projects in one column and names of .csv files in the second column. 我有一个输入文件,在第一列中有一个项目列表,在第二列中有.csv文件的名称。 These csv files are in the data dir of the app folder. 这些csv文件位于app文件夹的数据目录中。 When the app is fired, the user is asked to input the file with list of datasets/projects. 触发应用程序后,要求用户输入包含数据集/项目列表的文件。 That list is opened in the first tab. 该列表在第一个选项卡中打开。 My aim is to click on a particular row ie project name and the corresponding .csv file should open in the second tab. 我的目的是单击特定的行,即项目名称,相应的.csv文件应在第二个选项卡中打开。 When I click the first time, the corresponding csv file opens in the second tab, but when I go back to the first tab and click again, it gives me the following error: 第一次单击时,相应的csv文件在第二个选项卡中打开,但是当我返回第一个选项卡并再次单击时,它给我以下错误:

Error in file(file, "rt") : invalid 'description' argument

I have attached all my code and corresponding files. 我已经附上了所有代码和相应的文件。

ui.R 用户界面

dashboardPage(
  dashboardHeader(title = 'Title',titleWidth = 500),

  dashboardSidebar(width = 500,
    fluidRow(
      column(6, div(style = "height:10px"), 
             fileInput(inputId = 'inputdataset', label = 'Input Datasets', accept = c('csv','tsv','txt')))
    )
  ),

  dashboardBody(

    tabsetPanel(type="tabs", id = "tabvalue",
                tabPanel(title = "Project List", value='tab',DT::dataTableOutput('projects')),
                tabPanel(title = "Input Table", value = 'tab1', DT::dataTableOutput('table'))
    )
  )
)

server.R 服务器

library(shiny)
library(shinydashboard)

options(shiny.maxRequestSize = 30*1024^2)

shinyServer(function(input, output, session){

  # read in initial data input.csv i.e. a file containing list of projects
  # this file has a column of projects and a column of corresponding csv files
  # the third column in the table i.e. 'limma' specifies the names of the csv file
  # the data directory of the app folder contains those .csv files
  datainput <- reactive({
    infile <- input$inputdataset
    if(is.null(infile))
      return(NULL)
    read.csv(infile$datapath,check.names=F)
  })

  # output list of projects in projects tab
  # you can select any of the projects
  output$projects <- DT::renderDataTable({
    DT::datatable(datainput(), selection = 'single')
  })

  # go to tab1 when a project is selected 
  observe({
    s <- input$projects_rows_selected
    if(length(s)){
      updateTabsetPanel(session = session, inputId = "tabvalue", selected = 'tab1')
    }
  })

  # when a project is selected, the corresponding limma file is opened
  datasetInput <- reactive({
    d <- datainput()
    s <- input$projects_rows_selected
    dat <- d[s, , drop = FALSE]
    limma <- as.character(dat$limma)
    file <- paste('data/',limma,sep='')
    dd <- read.csv(file=file)
    dd
  })

  # output data for selected project in tab1
  output$table <- DT::renderDataTable({
      DT::datatable(datasetInput(),
                    selection = 'single')
  })
})

The input file: input.csv looks like this: 输入文件:input.csv如下所示:

Project,limma
Hdac3KO,Hdac3KO.csv
Ezh2KO,Ezh2KO.csv

.csv files for the two projects are in the data/ dir of the app as follows: 这两个项目的.csv文件位于应用程序的data /目录中,如下所示:

This is project 1 file, Hdac3KO.csv: 这是项目1文件Hdac3KO.csv:

ID,SYMBOL,ENTREZID,ENSEMBL
17278840,Mir376a,723855,NA
17350196,Scgb3a2,117158,ENSMUSG00000038791
17278838,Mir376b,723934,ENSMUSG00000076006
17326069,Retnla,57262,ENSMUSG00000061100
17315245,Krt18,16668,ENSMUSG00000023043

This is project 2 file, Ezh2KO.csv: 这是项目2文件Ezh2KO.csv:

ID,SYMBOL,ENTREZID,ENSEMBL
17278779,NA,NA,NA
17255543,Gm53,193022,NA
17335467,Cdkn1a,12575,ENSMUSG00000023067
17273304,Cbr2,12409,ENSMUSG00000025150

I'd really appreciate any help. 我真的很感谢您的帮助。

I was using an older version of package DT . 我使用的是DT包的旧版本。 Updated to DT_0.1.32 and it is working fine now. 已更新为DT_0.1.32 ,现在可以正常工作。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 文件(文件,“rt”)中的错误:调用函数时“描述”参数无效 - Error in file(file, "rt") : invalid 'description' argument , when calling the function for(seq_along(data_file)中的i:file(file,“ rt”)中的错误:无效的&#39;description&#39;参数 - for(i in seq_along(data_file): Error in file(file, “rt”) : invalid 'description' argument 文件错误(文件,“rt”):complete.cases 程序中的“描述”参数无效 - Error in file(file, "rt") : invalid 'description' argument in complete.cases program 文件错误(文件,“rt”):读取 csv 文件时“描述”参数无效 - Error in file(file, "rt") : invalid 'description' argument when reading csv files R Openxlsx 包(版本 4.2.2)-文件错误(描述 = xlsxFile):“描述”参数无效 - R Openxlsx package (version 4.2.2) - Error in file(description = xlsxFile) : invalid 'description' argument gzfile(fname,open =“ rt”)中的错误:无效的&#39;description&#39;参数 - Error in gzfile(fname, open = “rt”) : invalid 'description' argument 使用 openxlsx 将 Excel 数据导入 R:文件中的错误(con,“r”):无效的“描述”参数 - Import Excel data into R using openxlsx: Error in file(con, "r") : invalid 'description' argument 在R中安装网格:“错误:无效的Description文件” - Installing lattice in R: “Error : Invalid DESCRIPTION file” 文件中的错误(文件,ifelse(追加,“a”,“w”)):无效的“描述”参数 - Error in file(file, ifelse(append, “a”, “w”)) : invalid 'description' argument 如何解决错误“文件错误:无效的&#39;description&#39;参数? - How to resolve error " Error in file : invalid 'description' argument?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM