create.count.data: Aggregate distance data into count data

View source: R/create.count.data.R

create.count.dataR Documentation

Aggregate distance data into count data

Description

This function creates a new data set where dis.data is aggregated for each visit to a segment (segment.id). The sum of the estimated number of individuals for each segment from dis.data$NHAT is given in the column NHAT in the new data. Only columns from the segment or higher layers should be carried over into count.data from dis.data. Use argument column.numbers to identify these.

Usage

create.count.data(dis.data, column.numbers = NULL)

Arguments

dis.data

Data frame containing distance data (one row for each detection). Expects a column NHAT, i.e. size of detection divided by its probability of detection (see create.NHAT) and that ids in segment.id are unique regardless of what transect they belong to

column.numbers

Optional argument: vector of integers indicating which columns other than NHAT from dis.data should be retained in the returned data. Generally all columns from the segment and higher levels should be kept while those from the observation level should be discarded. If the default is used, column.numbers=NULL, the columns distance, object, size, distbegin and distend from the observation level are automatically discarded. Note that for those columns from the observation layer that are kept, only the first recorded value will be transferred.

Value

This function returns count data that is suited for second stage count modelling of distance sampling data. The data includes the columns NHAT and area which are the response and the offset required by functions concerned with second stage modelling from this package.

Examples

data(dis.data.re)
dis.data.re$survey.id<-paste(dis.data.re$season,dis.data.re$impact,sep="")
result<-ddf(dsmodel=~mcds(key="hn", formula=~1), data=dis.data.re, method="ds",
           meta.data=list(width=250))
dis.data.re<-create.NHAT(dis.data.re,result)
count.data<-create.count.data(dis.data.re)


lindesaysh/MRSea documentation built on May 1, 2024, 6:31 p.m.