Basic malariaAtlas usage.

Dan Pfeffer, Tim Lucas

2020-06-01

Overview

This package allows you to download parasite rate data (Plasmodium falciparum and P. vivax) and modelled raster outputs from the Malaria Atlas Project.

Available Data

The data can be interactively explored at https://malariaatlas.org/explorer/#/explorer. 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).

list* Functions

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.

is_available

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:

## 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

## 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:

## Confirming availability of Vector data for: Myanmar...
## Vector points are available for Myanmar.

Check whether Vector occcurrence data is available for the Brazil

## Confirming availability of Vector data for: BRA...
## Vector points are available for BRA.

Downloading & Visualising Data:

get* functions & autoplot methods

Parasite Rate Survey Points

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:

## Rows: 395
## Columns: 28
## $ dhs_id                    <lgl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,…
## $ 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", "…
## $ country_id                <chr> "MDG", "MDG", "MDG", "MDG", "MDG", "MDG", "…
## $ continent_id              <chr> "Africa", "Africa", "Africa", "Africa", "Af…
## $ month_start               <int> 1, 3, 1, 7, 4, 1, 1, 7, 4, 7, 11, 4, 9, 7, …
## $ year_start                <int> 1987, 1987, 1987, 1995, 1986, 1987, 1987, 1…
## $ month_end                 <int> 1, 3, 1, 8, 6, 1, 1, 8, 4, 8, 11, 6, 9, 8, …
## $ year_end                  <int> 1987, 1987, 1987, 1995, 1986, 1987, 1987, 1…
## $ lower_age                 <int> 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, 6…
## $ 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.2…
## $ species                   <chr> "P. falciparum", "P. falciparum", "P. falci…
## $ method                    <chr> "Microscopy", "Microscopy", "Microscopy", "…
## $ 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", "tr…
## $ location_available        <chr> "true", "true", "true", "true", "true", "tr…
## $ permissions_info          <chr> "", "", "", "", "", "", "", "", "", "", "",…
## $ citation1                 <chr> "Lepers, J.P., Ramanamirija, J.A., Andriama…
## $ citation2                 <chr> "", "", "", "", "", "", "", "", "", "", "",…
## $ citation3                 <lgl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,…

Vector Occurrnece points

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:

## Rows: 2,866
## Columns: 24
## $ site_id        <int> 30243, 30243, 30243, 30243, 1000000072, 1000000071, 10…
## $ 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, …
## $ 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, …
## $ anopheline_id  <int> 17, 17, 17, 17, 50, 49, 17, 51, 11, 4, 15, 1, 35, 30, …
## $ species        <chr> "Anopheles dirus species complex", "Anopheles dirus sp…
## $ species_plain  <chr> "Anopheles dirus", "Anopheles dirus", "Anopheles dirus…
## $ id_method1     <chr> "unknown", "unknown", "unknown", "unknown", "morpholog…
## $ 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", "a…
## $ sample_method3 <chr> "", "", "", "", "animal baited net trap", "animal bait…
## $ sample_method4 <chr> "", "", "", "", "house resting inside", "house resting…
## $ assi           <chr> "", "", "", "", "", "", "", "", "", "", "", "", "", ""…
## $ citation       <chr> "Oo, T.T., Storch, V. and Becker, N. (2003).  <b><i>An…
## $ geom           <chr> "POINT (16.257 97.725)", "POINT (16.257 97.725)", "POI…
## $ 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.vector.points is an autoplot method to enable quick mapping of the locations of downloaded vector occurrence points.

Furthermore, being ggplot2 plots, these plots can easily be added to or modified.

Shapefiles

getShp() downloads a shapefile for a specified country (or countries) and returns this as either a spatialPolygon or data.frame object.

## OGR data source with driver: ESRI Shapefile 
## Source: "/private/var/folders/41/fxbbs14d12lghz2yrbrhr6zr0000gn/T/RtmpJOnhTB/shp/shp10a694af0bf61/mapadmin_1_2018.shp", layer: "mapadmin_1_2018"
## with 22 features
## It has 12 fields
## OGR data source with driver: ESRI Shapefile 
## Source: "/private/var/folders/41/fxbbs14d12lghz2yrbrhr6zr0000gn/T/RtmpJOnhTB/shp/shp10a693a49fb7/mapadmin_2_2018.shp", layer: "mapadmin_2_2018"
## with 114 features
## It has 16 fields
## Formal class 'SpatialPolygonsDataFrame' [package "sp"] with 5 slots
##   ..@ data       :'data.frame':  136 obs. of  16 variables:
##   .. ..$ iso          : chr [1:136] "MDG" "MDG" "MDG" "MDG" ...
##   .. ..$ admn_level   : num [1:136] 1 1 1 1 1 1 1 1 1 1 ...
##   .. ..$ name_0       : chr [1:136] "Madagascar" "Madagascar" "Madagascar" "Madagascar" ...
##   .. ..$ id_0         : num [1:136] 1e+07 1e+07 1e+07 1e+07 1e+07 ...
##   .. ..$ type_0       : chr [1:136] "Country" "Country" "Country" "Country" ...
##   .. ..$ name_1       : chr [1:136] "Androy" "Anosy" "Atsimo Andrefana" "Atsimo Atsinanana" ...
##   .. ..$ id_1         : num [1:136] 1e+07 1e+07 1e+07 1e+07 1e+07 ...
##   .. ..$ type_1       : chr [1:136] "Region" "Region" "Region" "Region" ...
##   .. ..$ name_2       : chr [1:136] NA NA NA NA ...
##   .. ..$ id_2         : num [1:136] NA NA NA NA NA NA NA NA NA NA ...
##   .. ..$ type_2       : chr [1:136] NA NA NA NA ...
##   .. ..$ name_3       : logi [1:136] NA NA NA NA NA NA ...
##   .. ..$ id_3         : logi [1:136] NA NA NA NA NA NA ...
##   .. ..$ type_3       : logi [1:136] NA NA NA NA NA NA ...
##   .. ..$ source       : chr [1:136] "Madagascar NMCP 2016" "Madagascar NMCP 2016" "Madagascar NMCP 2016" "Madagascar NMCP 2016" ...
##   .. ..$ country_level: chr [1:136] "MDG_1" "MDG_1" "MDG_1" "MDG_1" ...
##   ..@ polygons   :List of 136
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
##   .. .. [list output truncated]
##   ..@ plotOrder  : int [1:136] 3 16 14 13 2 7 6 19 11 15 ...
##   ..@ bbox       : num [1:2, 1:2] 43.2 -25.6 50.5 -11.9
##   .. ..- attr(*, "dimnames")=List of 2
##   ..@ proj4string:Formal class 'CRS' [package "sp"] with 1 slot

autoplot.MAPshp configures autoplot method to enable quick mapping of downloaded shapefiles.

Modelled Rasters

getRaster()downloads publicly available MAP rasters for a specific surface & year, clipped to a given bounding box or shapefile

N.B. to use downloaded rasters and shapefiles directly with autoplot, use as.MAPraster() and as.MAPshp() to convert these to data.frames. Alternatively autoplot_MAPraster() will work directly with RasterLayer, RasterStack or RasterBrick objects downloaded with getRaster().

autoplot.MAPraster and autoplot_MAPraster are autoplot methods to enable quick mapping of downloaded rasters.