sliceCat: Categorize Observations as Slices for Matching Acoustic...

Description Usage Arguments Details Value Examples

View source: R/sliceCat.R

Description

Categorize observations as spatial slices for matching fish densities estimated from acoustic transects and species compositions estimated from midwater trawl catches.

Usage

1
sliceCat(sliceDef, fdp = NULL, bdp = NULL, lon = NULL, lat = NULL, reg = NULL)

Arguments

sliceDef

A list of at least two named sub-lists defining the slices into which observations will be classified. Each sub-list contains one or more named numeric vectors of length two, identifying the parameter (the name of the vector) and the range of values (see Details) that contribute to the slice definition, with one exception. For slicing by regions, the named vector is character (not numeric), is of length one or more (not necessarily two), and specifies all of the regions that contribute to the slice definition. The name of each sub-list is the name of the slice to be assigned. See Examples.

fdp

A numeric vector of fishing depths (the distance from the surface of the water to the depth of a fish in the water) corresponding to the observations which are to be categorized into slices. Only necessary if required by sliceDef, default NULL. default

bdp

A numeric vector of bottom depths (the distance from the surface of the water to the substrate) corresponding to the observations which are to be categorized into slices. Only necessary if required by sliceDef, default NULL.

lon

A numeric vector of longitudes corresponding to the observations which are to be categorized into slices. Only necessary if required by sliceDef, default NULL.

lat

A numeric vector of latitudes corresponding to the observations which are to be categorized into slices. Only necessary if required by sliceDef, default NULL.

reg

A character vector of regions corresponding to the observations which are to be categorized into slices. Only necessary if required by sliceDef, default NULL.

Details

For ranges of values, each interval of sliceDef is closed on the left and open on the right. In other words, if you assign an interval of fdp=c(10, 20), observations >= 10 and < 20 will be considered for inclusion in that slice.

All observation variables (fdp, bdp, lon, lat, reg), if not NULL, must be the same length.

Value

A character vector the same length as the observations variables (fdp, bdp, lon, lat, reg), identifying the slice to which each observation belongs.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
fishingD <- 1:7
bottomD <- c(2, 10, 4, 12, 6, 14, 8)
region <- c("a", "b", "c", "a", "b", "c", "a")

# slice by fishing depth and bottom depth
myslicedef <- list(
  epiNear = list( fdp=c(0, 4), bdp=c(0, 6) ),
  epiOff = list( fdp=c(0, 4), bdp=c(6, Inf) ),
  hypo = list( fdp=c(4, Inf) )
)
sliceCat(myslicedef, fdp=fishingD, bdp=bottomD)

# slice by fishing depth and region
myslicedef2 <- list(
  epiA = list( fdp=c(0, 4), reg="a" ),
  epiBC = list( fdp=c(0, 4), reg=c("b", "c") ),
  hypo = list( fdp=c(4, Inf) )
)
sliceCat(myslicedef2, fdp=fishingD, reg=region)

dmwarn/EchoNet2FishTO documentation built on March 6, 2021, 12:25 a.m.