extract_counts: Extract a count matrix from a data.frame

View source: R/functions.R

extract_countsR Documentation

Extract a count matrix from a data.frame

Description

Loops through unique values of 'occasion' and 'site' in a data.frame in order to extract the matrix of observed counts required for GAI model fitting

Usage

extract_counts(data_frame, checks = T, returnDF = T)

Arguments

data_frame

A data.frame with columns "site", "occasion" and "counts"

checks

if TRUE, checks that all counts are specified

returnDF

if TRUE returns instead a list with the matrix of counts as well as a reordered version of the data.frame so that the rows match the matrix output.

Value

A matrix of counts, with rows as sites and columns as occasions.

Examples

extract_counts(example_data)

calliste-fagard-jenkin/GAI documentation built on July 26, 2022, 11:20 a.m.