add_covariates: Add spatial covariates to mask or traps

Description Usage Arguments Author(s) Examples

Description

Based on the addCovariates function from secr but which also accommodates SpatialPointsDataFrame data objects.

Usage

1

Arguments

x

a gmask or gcapthist object.

data

a gshp object

Author(s)

Darren Kidney [email protected]

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
## Not run: 

library(secr)
library(ggplot2)
data(N.annamensis)

mask = make_mask(N.annamensis.capthist, spacing = 250, buffer = 6000)
head(covariates(mask[[1]]))

ggplot() + coord_fixed() +
    geom_mask(mask) +
    geom_capthist(N.annamensis.capthist) +
    labs(x = "Longitude", y = "Latitude")

mask = add_covariates(mask, N.annamensis.habitat)
head(covariates(mask[[1]]))

ggplot() + coord_fixed() +
    geom_mask(mask, covariate = "habitat") +
    geom_capthist(N.annamensis.capthist) +
    scale_fill_manual(values = c("darkgreen", "lightgreen")) +
    labs(x = "Longitude", y = "Latitude")

## End(Not run)

dkidney/gibbonsecr documentation built on May 15, 2019, 9:11 a.m.