I have made a updateSelectizeInput
function in my server.R
selectedData <- reactiveValues()
observeEvent(input$season, {
if(input$season == 1718) {
player_name <- pbp_1718 %>%
# Check for NAs
filter(!is.na(coords_x),
!is.na(coords_y),
!is.na(event_rinkside),
!is.na(event_player_1)) %>%
pull(event_player_1) %>%
unique()
player_name_title <- player_name %>%
str_replace_all("\\.", " ") %>%
str_to_title()
# Create title case names since choices argument says:
# If elements of the list are named, then that name rather than the value is displayed to the user.
names(player_name) <- player_name_title
selectedData <- player_name
} else {
player_name <- pbp_1819 %>%
# Check for NAs
filter(!is.na(coords_x),
!is.na(coords_y),
!is.na(event_rinkside),
!is.na(event_player_1)) %>%
pull(event_player_1) %>%
unique()
player_name_title <- player_name %>%
str_replace_all("\\.", " ") %>%
str_to_title()
# Create title case names since choices argument says:
# If elements of the list are named, then that name rather than the value is displayed to the user.
names(player_name) <- player_name_title
selectedData <- player_name
}
updateSelectizeInput(session, "player_shot",
choices = names(selectedData),
server = TRUE)
})
I hope my explanation takes place of a reproducible example.
Basically, users can select a season (1718 or 1819) and then according to the season, users see different groups of players inside selectizeInput
.
The problem I have is using the user's selection (input$player_shot
) in another plot located in the server. In my plot, I call input$player_shot
but it doesn't seem to be working...
If this explanation is lacking, I'll def post part of my entire script (Its 1000 lines long!)