subsample_catch: Subsample catch by year

View source: R/prepare_data.R

subsample_catchR Documentation

Subsample catch by year

Description

Randomly choose a subset of observations for some or all vessels etc.

Usage

subsample_catch(catch_df, n_df = NULL)

Arguments

catch_df

Catch data frame to subset

n_df

Data frame specifiying how to subset

Details

Takes subsets of observations by year and other characteristics. Subsetting is specified as a data frame. Any unspecified levels are not subset.

Value

A data frame with the same columns, subset as specified

Author(s)

John Best

Examples

## Not run: 
  ## To subset the observations of a single vessel, only specify a number of
  ## observations for that vessel
  subsample_catch(catch_df,
                  tibble(vessel_idx = 2,
                         n = 1000))
  ## To subset the observations for two vessels, specify a number of
  ## observations for each
  subsample_catch(catch_df,
                  tibble(vessel_idx = c(1, 2),
                         n = c(200, 1000)))

## End(Not run)

jkbest2/spatq documentation built on Sept. 22, 2022, 3:22 a.m.