# WARNING - Generated by {fusen} from /dev/dev_golem_module.Rmd: do not edit by hand
#' input UI Function
#'
#' @description A shiny Module.
#'
#' @param id,input,output,session Internal parameters for {shiny}.
#'
#' @noRd
#'
#' @importFrom shiny NS tagList
mod_input_ui <- function(id){
ns <- NS(id)
tagList(
# selectInput(inputId = ns("country"),
# label = " and filter by country..",
# choices = list("Panama" = "PAN",
# "Colombia" = "COL",
# "Ecuador" = "ECU",
# "United States" = "USA",
# "Mexico" = "MEX" ),
# selected = "Panama"),
selectizeInput(inputId = ns("country"),
label = " Select Country",
choices = ForcedDisplacementStat::end_year_population_totals |>
dplyr::arrange(CountryAsylumName) |>
dplyr::select(CountryAsylumCode) |>
dplyr::distinct() |>
dplyr::pull(CountryAsylumCode) |>
purrr::set_names(
ForcedDisplacementStat::end_year_population_totals |>
dplyr::arrange(CountryAsylumName) |>
dplyr::select(CountryAsylumName) |>
dplyr::distinct()|>
dplyr::pull(CountryAsylumName) ),
selected = "USA",
multiple = FALSE,
options = NULL),
selectInput(inputId = ns("year"),
label = " Select Year",
choices = list("2022" = "2022",
"2021" = "2021",
"2020" = "2020",
"2019" = "2019",
"2018" = "2018" ),
selected = "2022")
)
}
#' input Server Functions
#' @param reactiveParameters Main app filters defined through mod_input
#'
#' @noRd
mod_input_server <- function(id, reactiveParameters){
moduleServer( id, function(input, output, session){
ns <- session$ns
observe({
reactiveParameters$country <- input$country
})
observe({
reactiveParameters$year <- input$year
})
})
}
## To be copied in the UI
# mod_input_ui("input_1")
## To be copied in the server
# mod_input_server("input_1")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.