在我的情况下,我使用R闪亮仪表板进行数据可视化我希望将用户输入插入到r中的过滤数据框中
library(shiny)
library(shinydashboard)
ui <-
dashboardPage(
dashboardHeader(title = "Basic dashboard"),
dashboardSidebar(
sidebarMenu(
)
),
dashboardBody(
# Boxes need to be put in a row (or column)
fluidRow(
box(plotOutput("plot1", height = 250)),
box(
title = "",
sliderInput("slider", "Number of Breaks:", 1, 180, 50)
),
box(
selectInput('BILLING_CENTRE', 'Select Billing Center', names(dfList))
)
)
)
)
server <-
function(input, output) {
d <- read.csv('Events_for_Jan_suspensions.csv')
dfList <- split(d, d$BILLING_CENTRE)
abc <- reactive({input$BILLING_CENTRE})
if (abc == "AD"){
histdata <- dfList$AD$SU_TO_OK_DURATION
output$plot1 <- renderPlot({
data <- histdata[seq_len(input$slider)]
hist(data)
})
}
}
shinyApp(ui, server)