as.MAPraster {malariaAtlas} | R Documentation |
Convert Raster objects into MAPraster objects
Description
as.MAPraster
converts a RasterLayer or RasterStack object into a 'MAPraster' object (data.frame) for easy plotting with ggplot.
Usage
as.MAPraster(raster_object)
Arguments
raster_object |
RasterLayer or Rasterstack object to convert into a MAPraster. |
Value
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
See Also
to download rasters directly from MAP.
to convert RasterLayer/RasterStack objects into a 'MAPraster' object (data.frame) for easy plotting with ggplot.
to quickly visualise MAPraster objects created using as.MAPraster
.
Examples
# 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)
[Package malariaAtlas version 1.6.1 Index]