genetic_posteriors2rasters: Convert posteriors to particular genetic reporting groups...

Description Usage Arguments Value Examples

View source: R/genetics-maneuvers.R

Description

When birds have been assigned to breeding groups or "general areas" as in Ruegg et al. 2014 then the posterior probabilty with which the birds were assigned to the groups needs to be "smeared out" in a raster over the spatial extent of the groups.

Usage

1

Arguments

G

long format data frame like breeding_wiwa_genetic_posteriors. Has to have columns of ID, region, and posterior

R

a RasterStack like "genetic_regions". The sum of these should be the total known range. The names of the regions in R must be the same as the entries in the "region" column in G.

Value

This returns a list of rasters for each bird in G. The entries in the raster are the posterior probability of being from that cell. This assumes that birds are equally likely to come from any cell within the group's region. It doesn't return a rasterStack because you can't subset rasterStacks to change orders, etc., and it mangles names.

Examples

1
2
3
4
5
6
7
8
9
library(raster)  # needed to deal with "genetic_regions" variable
# get a small subset of individuals so it doesn't take too long
data(breeding_wiwa_genetic_posteriors)
data(genetic_regions)
BW <- breeding_wiwa_genetic_posteriors %>%
  dplyr::filter(Short_Name %in% c("eNBFR01", "wABCA05", "wORHA21"))

# run the function on those
GPRs <-  genetic_posteriors2rasters(BW, genetic_regions)

gaiah documentation built on July 8, 2020, 6:12 p.m.