闪亮的R和V查找

时间:2018-02-12 11:40:07

标签: r shiny

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

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

Med = 2.30 std = 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)
          )))

提前致谢

1 个答案:

答案 0 :(得分:0)

以下是此示例代码。您可以根据需要对其进行修改,但它的输出类似于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)