输入过滤器不适用于无功高图
Input filter not working for reactive highchart
我创建了一个输入滑块,让用户可以选择从我们的数据集中选择医院服务。我有一张图表,按年龄组显示患者人数。但是,我希望能够拥有基于服务的图表过滤器。这是我目前所拥有的,但它没有用。
library(flexdashboard)
library(highcharter)
library(DT)
library(dplyr)
library(shiny)
full_sql <- read.csv('clean.csv')
service_choice <- full_sql$Service
selectInput(inputId = "testsvc",
label = 'Services', service_choice)
ages_by_group <- full_sql %>%
group_by(Pediatric.Patient.Age.Grouper) %>%
summarise('Number of Patients' = n())
output$coolplot <- renderHighchart(
hchart(
ages_by_group %>%
filter('Service' >= input$testsvc),
type = "column",
hcaes(x = Pediatric.Patient.Age.Grouper, y = `Number of Patients`),
color = ocqi_colors("blue"),
dataLabels = list(enabled = TRUE)) %>%
hc_ocqi_opts() %>%
hc_add_theme(hc_theme_ocqi()) %>%
hc_title(text = list("Number of Patients by Age Groups"),
align = "left") %>%
hc_credits(enabled = TRUE, text = "Data Source: CDW, Chart Type: Bar") %>%
hc_yAxis(title = list(text = "Number of Patients")) %>%
hc_xAxis(title = list(text = "Age Group"))
)
你可能需要-
ages_by_group %>%
filter(Service %in% input$testsvc)
我创建了一个输入滑块,让用户可以选择从我们的数据集中选择医院服务。我有一张图表,按年龄组显示患者人数。但是,我希望能够拥有基于服务的图表过滤器。这是我目前所拥有的,但它没有用。
library(flexdashboard)
library(highcharter)
library(DT)
library(dplyr)
library(shiny)
full_sql <- read.csv('clean.csv')
service_choice <- full_sql$Service
selectInput(inputId = "testsvc",
label = 'Services', service_choice)
ages_by_group <- full_sql %>%
group_by(Pediatric.Patient.Age.Grouper) %>%
summarise('Number of Patients' = n())
output$coolplot <- renderHighchart(
hchart(
ages_by_group %>%
filter('Service' >= input$testsvc),
type = "column",
hcaes(x = Pediatric.Patient.Age.Grouper, y = `Number of Patients`),
color = ocqi_colors("blue"),
dataLabels = list(enabled = TRUE)) %>%
hc_ocqi_opts() %>%
hc_add_theme(hc_theme_ocqi()) %>%
hc_title(text = list("Number of Patients by Age Groups"),
align = "left") %>%
hc_credits(enabled = TRUE, text = "Data Source: CDW, Chart Type: Bar") %>%
hc_yAxis(title = list(text = "Number of Patients")) %>%
hc_xAxis(title = list(text = "Age Group"))
)
你可能需要-
ages_by_group %>%
filter(Service %in% input$testsvc)