This package allows you to download parasite rate data (Plasmodium falciparum and P. vivax) and modelled raster outputs from the Malaria Atlas Project.
The data can be interactively explored at https://data.malariaatlas.org/maps. This is also useful for finding information on the raster data available and checking the extents of different rasters (some are Africa only for example).
listData()
retrieves a list of available data to
download.
Use:
listData(datatype = “pr points”) OR listPoints(sourcedata = “pr points”) to see for which countries PR survey point data can be downloaded.
use listData(datatype = “vector points”) or listPoints(sourcedata = “vector points”) to see for which countries Vector Occurrence data can be downloaded.
use listData(datatype = “rasters”) OR listRaster() to see rasters available to download.
use listData(datatype = “shape”) OR listShp() to see shapefiles available to download.
library(malariaAtlas)
listData(datatype = "pr points")
listData(datatype = "vector points")
listData(datatype = "raster")
listData(datatype = "shape")
isAvailable_pr
confirms whether or not PR survey point
data is available to download for a specified country.
Check whether PR data is available for Madagascar:
isAvailable_pr(country = "Madagascar")
## Confirming availability of PR data for: Madagascar...
## PR points are available for Madagascar.
Check whether PR data is available for the United States of America
isAvailable_pr(ISO = "USA")
## Confirming availability of PR data for: USA...
## Specified location not found, see below comments:
##
## Data not found for 'USA', did you mean UGA OR SAU?
isAvailable_vec
confirms whether or not Vector
occurrence point data is available to download for a specified
country.
Check whether Vector occurrence data is available for Myanmar:
isAvailable_vec(country = "Myanmar")
## Confirming availability of Vector data for: Myanmar...
## Vector points are available for Myanmar.
Check whether Vector occcurrence data is available for the Brazil
isAvailable_vec(ISO = "BRA")
## Confirming availability of Vector data for: BRA...
## Vector points are available for BRA.
getPR()
downloads all publicly available PR data points
for a specified country and plasmodium species (Pf, Pv or BOTH) and
returns this as a dataframe with the following format:
<- getPR(country = "Madagascar", species = "both") MDG_pr_data
## Rows: 1,651
## Columns: 28
## $ dhs_id <chr> "", "", "", "", "", "", "", "", "", "", "", …
## $ site_id <int> 6221, 6021, 15070, 15795, 7374, 13099, 9849,…
## $ site_name <chr> "Andranomasina", "Andasibe", "Ambohimarina",…
## $ latitude <dbl> -18.7170, -19.8340, -18.7340, -19.7699, -25.…
## $ longitude <dbl> 47.4660, 47.8500, 47.2520, 46.6870, 46.9960,…
## $ rural_urban <chr> "UNKNOWN", "UNKNOWN", "UNKNOWN", "UNKNOWN", …
## $ country <chr> "Madagascar", "Madagascar", "Madagascar", "M…
## $ country_id <chr> "MDG", "MDG", "MDG", "MDG", "MDG", "MDG", "M…
## $ continent_id <chr> "Africa", "Africa", "Africa", "Africa", "Afr…
## $ month_start <int> 1, 3, 1, 7, 4, 1, 1, 7, 4, 7, 11, 4, 9, 7, 7…
## $ year_start <int> 1987, 1987, 1987, 1995, 1986, 1987, 1987, 19…
## $ month_end <int> 1, 3, 1, 8, 6, 1, 1, 8, 4, 8, 11, 6, 9, 8, 8…
## $ year_end <int> 1987, 1987, 1987, 1995, 1986, 1987, 1987, 19…
## $ lower_age <dbl> 0, 0, 0, 2, 7, 0, 0, 2, 6, 2, 2, 7, 0, 2, 2,…
## $ upper_age <int> 99, 99, 99, 9, 22, 99, 99, 9, 12, 9, 9, 22, …
## $ examined <int> 50, 246, 50, 50, 119, 50, 50, 50, 20, 50, 61…
## $ positive <dbl> 7.5, 126.0, 2.5, 6.0, 37.0, 13.5, 4.5, 11.5,…
## $ pr <dbl> 0.1500, 0.5122, 0.0500, 0.1200, 0.3109, 0.27…
## $ species <chr> "P. falciparum", "P. falciparum", "P. falcip…
## $ method <chr> "Microscopy", "Microscopy", "Microscopy", "M…
## $ rdt_type <chr> "", "", "", "", "", "", "", "", "", "", "", …
## $ pcr_type <lgl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, …
## $ malaria_metrics_available <chr> "true", "true", "true", "true", "true", "tru…
## $ location_available <chr> "true", "true", "true", "true", "true", "tru…
## $ permissions_info <chr> "", "", "", "", "", "", "", "", "", "", "", …
## $ citation1 <chr> "Lepers, J.P., Ramanamirija, J.A., Andriaman…
## $ citation2 <chr> "", "", "", "", "", "", "", "", "", "", "", …
## $ citation3 <lgl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, …
getVecOcc()
downloads all publicly available Vector
Occurrence data points for a specified country and mosquito species (if
required) and returns this as a dataframe with the following format:
<- getVecOcc(country = "Myanmar") MMR_vec_data
## Rows: 2,866
## Columns: 24
## $ site_id <int> 30243, 30243, 30243, 30243, 1000000072, 1000000071, 100…
## $ latitude <dbl> 16.257, 16.257, 16.257, 16.257, 17.350, 17.380, 17.380,…
## $ longitude <dbl> 97.725, 97.725, 97.725, 97.725, 96.041, 96.037, 96.037,…
## $ country <chr> "Myanmar", "Myanmar", "Myanmar", "Myanmar", "Myanmar", …
## $ country_id <chr> "MMR", "MMR", "MMR", "MMR", "MMR", "MMR", "MMR", "MMR",…
## $ continent_id <chr> "Asia", "Asia", "Asia", "Asia", "Asia", "Asia", "Asia",…
## $ month_start <int> 2, 3, 8, 9, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 10, …
## $ year_start <int> 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1998, 1…
## $ month_end <int> 2, 3, 8, 9, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 10, …
## $ year_end <int> 1998, 1998, 1998, 1998, 2000, 2000, 2000, 2000, 2000, 2…
## $ anopheline_id <int> 17, 17, 17, 17, 50, 49, 17, 51, 11, 4, 15, 1, 35, 30, 5…
## $ species <chr> "Anopheles dirus species complex", "Anopheles dirus spe…
## $ species_plain <chr> "Anopheles dirus", "Anopheles dirus", "Anopheles dirus"…
## $ id_method1 <chr> "unknown", "unknown", "unknown", "unknown", "morphology…
## $ id_method2 <chr> "", "", "", "", "", "", "", "", "", "", "", "", "", "",…
## $ sample_method1 <chr> "man biting", "man biting", "man biting", "man biting",…
## $ sample_method2 <chr> "animal baited net trap", "animal baited net trap", "an…
## $ sample_method3 <chr> "", "", "", "", "animal baited net trap", "animal baite…
## $ sample_method4 <chr> "", "", "", "", "house resting inside", "house resting …
## $ assi <chr> "", "", "", "", "", "", "", "", "", "", "", "", "", "",…
## $ citation <chr> "Oo, T.T., Storch, V. and Becker, N. (2003). <b><i>Ano…
## $ geom <chr> "POINT (16.257 97.725)", "POINT (16.257 97.725)", "POIN…
## $ time_start <chr> "1998-02-01", "1998-03-01", "1998-08-01", "1998-09-01",…
## $ time_end <chr> "1998-02-01", "1998-03-01", "1998-08-01", "1998-09-01",…
autoplot.pr.points
is an autoplot method to enable quick
mapping of the locations of downloaded PR points.
autoplot(MDG_pr_data)
autoplot.vector.points
is an autoplot method to enable
quick mapping of the locations of downloaded vector occurrence
points.
autoplot(MMR_vec_data)
Furthermore, being ggplot2 plots, these plots can easily be added to or modified.
<- autoplot(MDG_pr_data, printed = FALSE)
p +
p scale_fill_gradientn(colours = rev(palettetown::pokepal('charmeleon', spread = 3))) +
theme_minimal()
getShp()
downloads a shapefile for a specified country
(or countries) and returns this as either a spatialPolygon or data.frame
object.
<- getShp(ISO = "MDG", admin_level = c("admin1", "admin2")) MDG_shp
## Reading layer `mapadmin_1_2018' from data source
## `/tmp/RtmpVY6TzK/shp/shp10a2e75680d35/mapadmin_1_2018.shp'
## using driver `ESRI Shapefile'
## Simple feature collection with 22 features and 12 fields
## Geometry type: MULTIPOLYGON
## Dimension: XY
## Bounding box: xmin: 43.19138 ymin: -25.60895 xmax: 50.48378 ymax: -11.94543
## Geodetic CRS: WGS 84
## Reading layer `mapadmin_2_2018' from data source
## `/tmp/RtmpVY6TzK/shp/shp10a2e3ae91cbe/mapadmin_2_2018.shp'
## using driver `ESRI Shapefile'
## Simple feature collection with 114 features and 16 fields
## Geometry type: MULTIPOLYGON
## Dimension: XY
## Bounding box: xmin: 43.19138 ymin: -25.60895 xmax: 50.48378 ymax: -11.94543
## Geodetic CRS: WGS 84
## Rows: 136
## Columns: 17
## $ iso <chr> "MDG", "MDG", "MDG", "MDG", "MDG", "MDG", "MDG", "MDG", …
## $ admn_level <dbl> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,…
## $ name_0 <chr> "Madagascar", "Madagascar", "Madagascar", "Madagascar", …
## $ id_0 <dbl> 10000910, 10000910, 10000910, 10000910, 10000910, 100009…
## $ type_0 <chr> "Country", "Country", "Country", "Country", "Country", "…
## $ name_1 <chr> "Androy", "Anosy", "Atsimo Andrefana", "Atsimo Atsinanan…
## $ id_1 <dbl> 10023001, 10023002, 10023003, 10022990, 10023000, 100229…
## $ type_1 <chr> "Region", "Region", "Region", "Region", "Region", "Regio…
## $ name_2 <chr> "name_2", "name_2", "name_2", "name_2", "name_2", "name_…
## $ id_2 <chr> "id_2", "id_2", "id_2", "id_2", "id_2", "id_2", "id_2", …
## $ type_2 <chr> "type_2", "type_2", "type_2", "type_2", "type_2", "type_…
## $ name_3 <chr> "name_3", "name_3", "name_3", "name_3", "name_3", "name_…
## $ id_3 <chr> "id_3", "id_3", "id_3", "id_3", "id_3", "id_3", "id_3", …
## $ type_3 <chr> "type_3", "type_3", "type_3", "type_3", "type_3", "type_…
## $ source <chr> "Madagascar NMCP 2016", "Madagascar NMCP 2016", "Madagas…
## $ geometry <MULTIPOLYGON [°]> MULTIPOLYGON (((45.25095 -2..., MULTIPOLYGO…
## $ country_level <chr> "MDG_1", "MDG_1", "MDG_1", "MDG_1", "MDG_1", "MDG_1", "M…
autoplot.sf
configures autoplot method to enable quick
mapping of downloaded shapefiles.
autoplot(MDG_shp)
getRaster()
downloads publicly available MAP rasters for
a specific surface & year, clipped to a given bounding box or
shapefile
<- getShp(ISO = "MDG", admin_level = "admin0")
MDG_shp <- getRaster(surface = "Plasmodium falciparum PR2-10", shp = MDG_shp, year = 2013) MDG_PfPR2_10
autoplot.SpatRaster
and
autoplot.SpatRasterCollection
are autoplot methods to
enable quick mapping of downloaded rasters.
<- autoplot(MDG_PfPR2_10, shp_df = MDG_shp) p
By using the above tools along with ggplot, simple comparison figures can be easily produced.
<- getShp(ISO = "MDG", admin_level = "admin0")
MDG_shp <- getRaster(surface = "Plasmodium falciparum PR2-10", shp = MDG_shp, year = 2013)
MDG_PfPR2_10
<- autoplot(MDG_PfPR2_10, shp_df = MDG_shp, printed = FALSE)
p
<- getPR(country = c("Madagascar"), species = "Pf")
pr 1]] +
p[[geom_point(data = pr[pr$year_start==2013,], aes(longitude, latitude, fill = positive / examined, size = examined), shape = 21)+
scale_size_continuous(name = "Survey Size")+
scale_fill_distiller(name = "PfPR", palette = "RdYlBu")+
ggtitle("Raw PfPR Survey points\n + Modelled PfPR 2-10 in Madagascar in 2013")
## Error in p[[1]] + geom_point(data = pr[pr$year_start == 2013, ], aes(longitude, : non-numeric argument to binary operator
<- getShp(ISO = "MMR", admin_level = "admin0")
MMR_shp <- getRaster(surface = "Anopheles dirus species complex", shp = MMR_shp)
MMR_an_dirus
<- autoplot(MMR_an_dirus, shp_df = MMR_shp, printed = FALSE)
p
<- getVecOcc(country = c("Myanmar"), species = "Anopheles dirus")
vec 1]] +
p[[geom_point(data = vec, aes(longitude, latitude), shape = 21, show.legend = TRUE)+
scale_fill_distiller(name = "Predicted distribution of Anopheles dirus species complex", palette = "RdYlBu")+
ggtitle("Raw Vector Survey points\n + The predicted distribution of Anohpeles dirus species complex")
## Error in p[[1]] + geom_point(data = vec, aes(longitude, latitude), shape = 21, : non-numeric argument to binary operator