abapToSpOcc_single: ABAP to spOccupancy (single-species)

View source: R/abapToSpOcc_single.R

abapToSpOcc_singleR Documentation

ABAP to spOccupancy (single-species)

Description

This function transforms a raw ABAP data frame (returned by getAbapData) into an list which can be used to fit single-species occupancy models using spPGOcc (spatial) or PGOcc (non-spatial). The spOccupancy package fits single-species, multi-species, and integrated non-spatial and spatial occupancy models using Markov Chain Monte Carlo (MCMC).

Usage

abapToSpOcc_single(abap_data, pentads = NULL, proj_coords = TRUE)

Arguments

abap_data

single-season ABAP data downloaded using getAbapData.

pentads

an sf object returned by getRegionPentads. Defaults to NULL.

proj_coords

logical value indicating whether pentad coordinates are projected (TRUE) or kept in decimal degree format (FALSE). Defaults to TRUE. See details below for coordinate reference system used during transformation.

Details

The spPGOcc function takes coords as an argument with X and Y coordinates included for each site. Within the context of ABAP, these coords are the centroid of each sampling pentad. In order to provide these spatial data to this function, simply use getRegionPentads and provide the same inputs for .region_type and .region that are specified in corresponding getAbapData call. If proj_coords is set to TRUE then the coordinates will be transformed using the African Albers Equal Area coordinate system (see here for details). This projection is best suited for land masses extending in an east-to-west orientation at mid-latitudes making it suitable for projecting pentads in Southern Africa. The functions in the spOccupancy package assume that coordinates are projected so for best results it is recommended to always project the data.

If pentads are specified then the output can be automatically used in spPGOcc. If no spatial data are provided the output can be used in PGOcc.

In addition to reformatting the detection/non-detection ABAP data for use in spOccupancy occupancy models, this function also extracts two survey-level covariates and adds them to the output list: hours and jday. The hours variable is the total number of hours spent atlassing which is recorded on the pentad card and jday is the Julian day corresponding to the first day of atlassing for that card.

Value

A list containing data necessary for model fitting in spOccupancy. List elements are y (detection/non-detection data), det.covs (survey-level covariates), and coords (x and y centroids of pentads if spatial data are supplied).

Note

The processing time of abapToSpOcc_single can be considerably long if the number of cards and pentads of the focal species is high, so patience may be required.

Author(s)

Dominic Henry dominic.henry@gmail.com
Pachi Cervantes

See Also

spPGOcc, PGOcc

Examples

abap_data <- getAbapData(.spp_code = 212,
                         .region_type = "province",
                         .region = "Eastern Cape",
                         .years = 2012)

abap_pentads <- getRegionPentads(.region_type = "province",
                                 .region = "Eastern Cape")


## Return list for spatial occupancy model
spOcc <- abapToSpOcc_single(abap_data, abap_pentads)
str(spOcc)

## Return list for spatial occupancy model (without coordinate projection)
spOcc <- abapToSpOcc_single(abap_data, abap_pentads, proj_coords = FALSE)
str(spOcc)

## List for non-spatial occupancy model
spOcc <- abapToSpOcc_single(abap_data)
str(spOcc)


AfricaBirdData/ABAP documentation built on Aug. 4, 2024, 4:41 p.m.