visitsSummary: Summarises visits

View source: R/visitsSummary.R

visitsSummaryR Documentation

Summarises visits

Description

This function takes a formatOccData object and returns a dataframe summarising the percentage of total sites that have been visited twice or more (i.e. revisited) within each closure period, as well as the mean number of visits to sites that have been visited two times or more for each closure period.

Usage

visitsSummary(x)

Arguments

x

A formatOccData object (an object of class List, of 2 dataframe components (spp_vis and occDetdata).

Value

A dataframe that forefills the selection criteria.

Examples

## Not run: 

set.seed(123)

# Create data
n <- 15000 #size of dataset
nyr <- 20 # number of years in data
nSamples <- 100 # set number of dates
nSites <- 50 # set number of sites

# Create somes dates
first <- as.Date(strptime("2010/01/01", "%Y/%m/%d")) 
last <- as.Date(strptime(paste(2010+(nyr-1),"/12/31", sep=''), "%Y/%m/%d")) 
dt <- last-first 
rDates <- first + (runif(nSamples)*dt)

# taxa are set as random letters
taxa <- sample(letters, size = n, TRUE)

# sites are visited randomly
site <- sample(paste('A', 1:nSites, sep=''), size = n, TRUE)

# the date of visit is selected at random from those created earlier
survey <- sample(rDates, size = n, TRUE)

# Format the data
visitData <- formatOccData(taxa = taxa, site = site, survey = survey)

# Summarise visits
visitsSummary(visitData)


## End(Not run)

BiologicalRecordsCentre/sparta documentation built on April 22, 2024, 2:34 p.m.