plotting map based on user input on df

Building my first web app with Shiny which uses plot() to display a map. I am hoping for some guidance on the most suitable way to render a map in this way based on user input in the UI component (it is a dashboard). An example of my data frame :

> Age        Sex    Region  1980  1981  1982  1983  1984  1985  1986  1987  1988  1989  1990  1991  1992
> 1 0 - 4 years F   North West  4437  4502  4431  4340  4251  4145  4028  3904  3747  3591  3455  3339  3241
> 2 0 - 4 years F    South West  5258  5319  5324  5302  5281  5235  5171  5028  4841  4655  4493  4356  4239
> 3 0 - 4 years F   North East 9186  9293  9211  9087  8965  8805  8617  8318  7948  7586  7267  6992  6947
> 4 0 - 4 years F     South East 40251 40533 40061 39407 38766 37965 37049 36009 34649

As you can see there is a column which contains gender info, one for age info (in groups) and then each column after region contains data for the year and corresponds to data on that observation.
Please advise on the best function / packages to render a map in the UI based on the user input for this type of operation on the data frame.

My code so far uses plotOutput in the UI to display the map with the data frame and a shapefile for each region. I would like to allow the user to select age group and sex and year to toggle with.

The main question is if you desire your map to be static, or interactive.

For a static use case I recommend ggplot2::geom_sf(), for a dynamic use case {leaflet}. You may also consider {tmap} which handles both with very little code required.

For an overview of mapping packages consider this Best packages for making map? leaflet vs ggmap vs sf vs ...?

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.