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

View source: R/getPR.R

as.pr.pointsR Documentation

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

#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


## End(Not run)

malaria-atlas-project/malariaAtlas documentation built on Nov. 5, 2023, 2:03 p.m.