Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add text placeholders and year filter #40

Merged
merged 5 commits into from
Aug 24, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
tweak filtering so download is filtered by year also
  • Loading branch information
Aariq committed Aug 22, 2022
commit 9347fd09af448a2b17b7c7e4f6fb5f646ba3569f
17 changes: 8 additions & 9 deletions app/app.R
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ ui <- fluidPage(
),

fluidRow(

## Plot output -------------------------------------------------------------
plotOutput(
"sankey",
width = "100%", #span entire page
Expand All @@ -62,13 +60,14 @@ ui <- fluidPage(
server <- function(input, output, session) {

# Filter data by selectize input ------------------------------------------
sankey_data <- callModule(
sankey_filtered <- callModule(
module = selectizeGroupServer,
id = "my-filters",
data = articles,
vars = c("domain", "biomarker", "collection",
"frequency", "communication", "behavior", "outcome")
)
)


# Render the plot --------------------------------------------------------
output$sankey <- renderPlot({
Expand All @@ -81,10 +80,10 @@ server <- function(input, output, session) {
#could still update highlighting with every change by using sankey_data() in
#a scale_color* call possibly. Worry about this later in case we don't end
#up sticking with ggplot
plotdf <- isolate(
sankey_data() %>%
filter(year >= input$year_range[1] & year <= input$year_range[2])
) %>%
sankey_data <- isolate(sankey_filtered() %>%
filter(year >= input$year_range[1] & year <= input$year_range[2]))

plotdf <- sankey_data %>%
ggsankey::make_long(
domain,
biomarker,
Expand Down Expand Up @@ -136,7 +135,7 @@ server <- function(input, output, session) {
paste('data-', Sys.Date(), '.csv', sep='')
},
content = function(file) {
write.csv(sankey_data(), file)
write.csv(sankey_data, file)
}
)
}
Expand Down