Learn R Programming

malariaAtlas (version 0.0.4)

as.pr.points: Convert data.frames to pr.points objects.

Description

Will create empty columns for any missing columns expected in a pr.points data.frame. This function is particularly useful for use with packages like dplyr that strip objects of their classes.

Usage

as.pr.points(x)

Arguments

x

A data.frame

Examples

Run this code
# NOT RUN {
#Download PfPR data for Nigeria and Cameroon and map the locations of these points using autoplot
# }
# NOT RUN {
library(dplyr)
NGA_CMR_PR <- getPR(country = c("Nigeria", "Cameroon"), species = "Pf")

# Filter the data frame then readd pr.points class so that autoplot can be used.
NGA_CMR_PR %>% 
  filter(year_start > 2010) %>% 
  as.pr.points %>% 
  autoplot

# }

Run the code above in your browser using DataLab