as.MAPraster | R Documentation |
as.MAPraster
converts a RasterLayer or RasterStack object into a 'MAPraster' object (data.frame) for easy plotting with ggplot.
as.MAPraster(raster_object)
raster_object |
RasterLayer or Rasterstack object to convert into a MAPraster. |
as.MAPraster
returns a MAPraster object (data.frame) containing the below columns.
x
- x coordinates of raster pixels
y
- y coordinates of raster pixels
z
- value of raster pixels
raster_name
- name of raster for which values are stored in z
getRaster
:
to download rasters directly from MAP.
as.MAPraster
:
to convert RasterLayer/RasterStack objects into a 'MAPraster' object (data.frame) for easy plotting with ggplot.
autoplot.MAPraster
:
to quickly visualise MAPraster objects created using as.MAPraster
.
# Download PfPR2-10 Raster for Madagascar in 2015 and visualise this on a map.
## Not run:
MDG_shp <- getShp(ISO = "MDG", admin_level = "admin0")
MDG_PfPR2_10 <- getRaster(surface = "Plasmodium falciparum PR2-10", shp = MDG_shp, year = 2015)
MDG_PfPR2_10 <- as.MAPraster(MDG_PfPR2_10)
autoplot(MDG_PfPR2_10)
## End(Not run)
#Download global raster of G6PD deficiency from Howes et al 2012 and visualise this on a map.
## Not run:
G6PDd_global <- getRaster(surface = "G6PD Deficiency Allele Frequency")
G6PDd_global <- as.MAPraster(G6PDd_global)
autoplot(G6PDd_global)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.