Map_DB {SchoolDataIT} | R Documentation |
Map school data
Description
This function displays a map of the data arranged trough the function Set_DB
.
It supports two kinds of map:
Interactive map (default option), which allows the user to visualize all the data in scope through the interactive popup, and
Static map (ggplot), which can be easily exported in
.pdf
objects.
The user must select a variable to display.
It is possible to insert either a readily-downloaded database obtained through the function Set_DB
or the basic inputs to plug in that function, other than an input shapefile. Relevant arguments not provided by the user will be download automatically, but not saved into the global environment. However we suggest to plug in at least some inputs, as otherwise the running time may be long.
This function generalises the functionalities of the more data-specific functions Map_School_Buildings
and Map_Invalsi
.
Usage
Map_DB(
data = NULL,
Year = 2023,
field,
level = "LAU",
plot = "mapview",
popup_height = 200,
col_rev = FALSE,
pal = "Blues",
input_shp = NULL,
region_code = c(1:20),
main_pos = "top",
main = "",
order = NULL,
autoAbort = FALSE,
...
)
Arguments
data |
Object of class |
Year |
Numeric or Character. The reference school year, needed if either |
field |
Character. The variable to display in the map. |
level |
Character. The administrative level of detailed at which the target variable must be displayed. Either |
plot |
Character. The type of map to display; either |
popup_height |
Numeric. The height of the popup table in terms of pixels if the |
col_rev |
Logical. Whether the scale of the colour palette should be reverted or not. |
pal |
Character. The palette to use if the |
input_shp |
Object of class |
region_code |
Numeric. The NUTS-2 codes of the units that must be displayed.
If the level is set to |
main_pos |
Character.Where the header should be placed if the |
main |
Character. The title to display in the |
order |
Character. The educational level. Either |
autoAbort |
Logical. In case any data must be retrieved, whether to automatically abort the operation and return NULL in case of missing internet connection or server response errors. |
... |
Additional arguments for the input database, if not provided; see |
Value
If plot == "mapview"
, an object of class mapview
. Otherwise, if plot == "ggplot"
, an object of class gg
and ggplot
.
Examples
DB23 <- Set_DB(Year = 2023, level = "NUTS-3",
Invalsi_grade = c(10,13), NA_autoRM = TRUE,
input_Invalsi_IS = example_Invalsi23_prov, input_nstud = example_input_nstud23,
input_InnerAreas = example_InnerAreas,
input_School2mun = example_School2mun23,
input_AdmUnNames = example_AdmUnNames20220630,
nteachers = FALSE, BroadBand = FALSE, SchoolBuildings = FALSE)
Map_DB(DB23, field = "Students_per_class_13", input_shp = example_Prov22_shp, level = "NUTS-3",
col_rev = TRUE, plot = "ggplot")
Map_DB(DB23, field = "Inner_area", input_shp = example_Prov22_shp, order = "High",
level = "NUTS-3",col_rev = TRUE, plot = "ggplot")
Map_DB(DB23, field = "M_Mathematics_10", input_shp = example_Prov22_shp, level = "NUTS-3",
plot = "ggplot")