yearSample: Samples along the year dimension

View source: R/FLQuant.R

yearSampleR Documentation

Samples along the year dimension

Description

A resample from an FLQuant object along the 'year' dimension is returned. The 'year' dimnames of the output object can be specified, although that is not needed if the resample is to be assigned in a slot.

Usage

yearSample(x, size = length(years), years, replace = TRUE, prob = NULL)

Arguments

x

An FLQuant object.

size

Number of samples (years), non-negative integer.

years

Optional vector to set as 'year' dimnames in output.

replace

should sampling be with replacement? Defaults to TRUE.

prob

a vector of probability weights.

Value

RETURN Description, class

Author(s)

Iago Mosqueira (WMR)

See Also

FLQuant sample()

Examples

data(ple4)
# Take 20 samples of recent recruitment 
yearSample(rec(ple4)[, ac(2013:2017)], 20)
# Providing 'years' sets the output object dimnames
yearSample(rec(ple4)[, ac(2013:2017)], 20, year=2000:2019)

flr/FLCore documentation built on May 4, 2024, midnight