【问题标题】:R shiny upload a .rda fileR闪亮上传.rda文件
【发布时间】:2015-05-16 01:01:54
【问题描述】:

我无法上传和显示带有 R 中闪亮库的 rda 文件。 有人知道怎么做吗? 我使用 R 版本 3.1.1。 这是使用闪亮的网站:http://shiny.rstudio.com

**

#ui.R
library(shiny)
shinyUI(navbarPage("MareyMap online",

                   tabPanel("Présentation",

h2("A web-service for estimating recombination rates along the genome",align="center"),

br()

),

tabPanel("Step 1 : Data Selection",


         fileInput("file", label = h3("or upload a data set")),
                         'Note: Upload the marey map data for your species using the following format: txt, rda,
Rda, rdata or Rdata.',

        "Optional -- Would you agree to include your dataset in our database after data curation",

         tableOutput("table")

         )
))
#server.R
library(shiny)
library(MareyMap)
shinyServer(function(input, output) {

  output$table <- renderPrint({
    input$file
  })  
})

**

【问题讨论】:

  • renderPrint 中尝试load(input$file$datapath) 而不是input$file 并查看shiny.rstudio.com/gallery/file-upload.html
  • 当我在renderPrint 中使用load(input$file$datapath)而不是input$file时,控制台显示Error in load(input$file$datapath) : bad 'file' argument
  • 您尝试加载的对象的名称是什么?如何在 R 中以正常方式加载它?
  • 这个错误是因为你还没有选择一个文件。
  • 如果你在ui.R中使用tableOutput,最好在server.R中使用renderTable

标签: r shiny rda


【解决方案1】:

它不起作用,但最后我尝试使用 .txt 文件:

“set”“map”“mkr”“phys”“gen”“vld” "拟南芥" "染色体 1" "SGCSNP131" 184351 0 TRUE “拟南芥”“1号染色体”“SGCSNP5”189722 2.61 TRUE "拟南芥" "染色体 1" "SGCSNP247" 662031 2.54 TRUE “拟南芥”“1号染色体”“GST1”663291 3.99 TRUE "拟南芥" "染色体 1" "SGCSNP151" 1148355 3.35 TRUE “拟南芥”“染色体 1”“AtEAT1”1435872 3.87 TRUE “拟南芥”“染色体 1”“ve002”1521308 7.15 真 “拟南芥”“1号染色体”“SGCSNP388”1526933 7.66 TRUE "拟南芥" "染色体 1" "SGCSNP170" 1642565 7.66 TRUE “拟南芥”“1号染色体”“ve003”2032443 7.76 TRUE “拟南芥”“1号染色体”“SGCSNP308”2664435 0.89 TRUE “拟南芥”“1号染色体”“phyA”3097714 11.35 TRUE “拟南芥”“1号染色体”“SGCSNP107”3097951 11.86 TRUE “拟南芥”“1号染色体”“SGCSNP138”3121108 14.69 TRUE "拟南芥" "染色体 1" "SGCSNP270" 3190609 13.8 TRUE “拟南芥”“1号染色体”“ve005”3194953 11.48 TRUE “拟南芥”“1号染色体”“nga63”3224435 11.48 TRUE “拟南芥”“1号染色体”“ARR4”3443848 11.35 TRUE “拟南芥”“1号染色体”“SGCSNP148”3658292 11.99 TRUE “拟南芥”“1号染色体”“BFN1”3773426 11.98 TRUE “拟南芥”“1号染色体”“NCC1”4107626 12.6 TRUE “拟南芥”“1号染色体”“ve006”4459553 16.13 TRUE “拟南芥”“1号染色体”“SGCSNP132”4588103 14.04 TRUE ...

服务器.R

图书馆(闪亮) 图书馆(马雷地图)

shinyServer(函数(输入,输出){

输出$table

#data(Arabidopsis_thalianan)
#Arabidopsis_thalianan@maps  

})

输出$table2

inFile <- input$file

if (is.null(inFile))
  return(NULL)

read.csv(inFile$datapath, header = TRUE,
         sep = ' ', quote ='"')

})

输出$table3

inFile <- input$file

if (is.null(inFile))
  return(NULL)

a<-read.csv(inFile$datapath, header = TRUE,
         sep = ' ', quote ='"')
a[,"map"]

})

})

ui.R

图书馆(闪亮)

shinyUI(navbarPage("MareyMap online",

               tabPanel("Présentation",
                        
                        h2("A web-service for estimating recombination rates along the genome",align="center"),
                        
                        
                        br(),
                        
                        helpText("MareyMap allows to estimate local recombination rates along the genome. MareyMap relies on
                                 comparing the genetic and the physical maps of a given chromosome to estimate local recombination
                                 rates (given by the slope of the curve describing the relationship between both variables), a graphical
                                 method called the Marey map method introduced by A. Chakravarti in 1991 . MareyMap accepts Marey
                                 map data as input (genetic and physical positions of markers for a set of chromosomes of a species) and
                                 will return local recombination rate estimates.")
                        ),
               
               
               
               tabPanel("Step 1 : Data Selection",
                        
                        selectInput("dataset", label = h3("Select a dataset in our database",align="center"),
                                    choices = c("Arabidopsis_thalianan", "Caenorhabditis_elegans" ,
                                                "Drosophila melanogaster","Homo sapiens")),
                        
                        fileInput("file", label = h3("or upload a data set")),
                        'Note: Upload the marey map data for your species using the following format: txt',
                        
                        br(),
                        br(),
                        
                        "Optional -- Would you agree to include your dataset in our database after data curation",
                        
                        textOutput("table"),
                        tableOutput("table2")
                        
                        
               ),
               tabPanel("Step 2 : Data curation",
                        "list of chromosomes:",
                        br(),
                        tableOutput("table3")
               ),
               tabPanel("Step 3 : Interpolation"),
               tabPanel("Step 4 : Rec Rates export")
                        ))

但我不能只显示地图列。

【讨论】:

    猜你喜欢
    • 2013-06-26
    • 1970-01-01
    • 2020-10-18
    • 2016-03-30
    • 2015-10-14
    • 2017-11-03
    • 2015-10-13
    • 2015-05-15
    • 2021-09-04
    相关资源
    最近更新 更多