【问题标题】:Shiny R and V lookup闪亮的 R 和 V 查找
【发布时间】:2018-07-22 13:46:53
【问题描述】:

我有一个名为UP 的数据框。我在 Shiny Dashboard 中调用表格。

数据框UP如下。我正在R中寻找Vlook类型。例如,当我在selectInput对话框中选择HCV时,我应该进入server.r

医学 = 2.30 标准 = 1.80

UP   
 Application                      Median     `Std Deviation`
    1 LCV (Ex . Tata Ace)          2.04           0.800
    2 Passanger Car _ UV Segment   11.2            3.35 
    3 Passanger Car_ Mini          11.4            6.10 
    4 HCV                          2.30            1.80

 usagepat = setNames(UP$Application, nm = UP$Application)

 shinyUI(
        dashboardPage(
       box(selectInput(inputId = "usepat", choices = usagepat, label = "Application", selected = FALSE), width = 5)
          )))

提前致谢

【问题讨论】:

    标签: r shiny


    【解决方案1】:

    下面是示例代码。您可以根据需要对其进行修改,但它会提供类似于 VLookup 的输出:

    df <- read.csv(path to raw data file)
    
    ui <- fluidPage(
    
    (selectInput(inputId = "usepat", label = "Application", choices = df$Application)),
    
    mainPanel(
      tabsetPanel(
        tabPanel("Data", tableOutput("tbTable"))
      )))
    
    server <- function(input, output) {
    
    myData <- reactive({
    req(input$usepat)
    res <- df[which(df$Application == input$usepat),]
    #return results
    res
    })
      output$tbTable <- renderTable(myData())}
    
     shinyApp(ui, server)
    

    【讨论】:

      猜你喜欢
      • 2019-05-03
      • 1970-01-01
      • 2016-07-25
      • 2017-05-15
      • 1970-01-01
      • 2017-04-04
      • 2016-11-06
      • 2017-07-25
      • 1970-01-01
      相关资源
      最近更新 更多