stratisfy: stratisfy

View source: R/stratisfy.R

stratisfyR Documentation

stratisfy

Description

stratisfy is a program capable of Stratified Analyses of both DFO and NMFS fisheries survey data. This package attempts to emulate the results of the older, APL version which has been in use for many years.

Using stratisfy requires:

  1. an Oracle account on the DFO PTRAN database;

  2. access to PTRAN (i.e. either within the network, or via a VPN)

  3. appropriate select permissions on the 'groundfish' and/or 'usnefsc' schemas

New Oracle accounts are requested by filling out a computer account request form. These forms may be obtained from IM&TS. Select access to the DFO and NMFS data is provided by the respective datasets manager (checking with Mike.McMahon@dfo-mpo.gc.ca is a good start).

Users can supply as much or as little information as they want when calling stratisfy(). If required information is not supplied, a select box will show the available options to the user. Please see below for examples of function calls providing both the minimum and the maximum number of parameters.

Fun Facts About stratisfy

  1. Berried Females – APL stratisfy was inconsistent with species where females could be coded as 'berried' (i.e. 3). When unsexed analyses were done, the females were included, but when sexed analyses were done, these females were not included in the results. Such inconsistency seems suboptimal, and is retained for now such that APL and R versions of the application can be compared.

  2. Ages By Sex – When APL stratisfy did analyses by sex, it combined the sexes for the 'Age Mean', 'Age Total', (and standard errors of each). This version adds the parameter ageBySex so that by setting it to FALSE, you can get the combined results, but you can also set it to TRUE, and get the values for each sex individually.

  3. I liked the old way – Some aspects of the 'classic' (i.e. APL) stratisfy seemed inefficient. For example, the Strata information was broken up over multiple worksheets, as was the weight information. By default, a new spreadsheet has been designed, but since there will always be those who prefer the old way, setting output='classic' will generate a spreadsheet almost indistinguishable from the APL version.

Usage

stratisfy(
  usepkg = "rodbc",
  agency = "DFO",
  type = 1,
  year = NULL,
  season = NULL,
  missions = NULL,
  strataTable = NULL,
  wingspread = 41,
  towDist = 1.75,
  strata = NULL,
  areas = NULL,
  spp = NULL,
  bySex = NULL,
  ageBySex = FALSE,
  useBins = T,
  output = "new",
  alkTable = NULL,
  file_id = NULL,
  fn.oracle.username = "_none_",
  fn.oracle.password = "_none_",
  fn.oracle.dsn = "_none_"
)

Arguments

usepkg

The default value is 'rodbc', but 'roracle' works as well. This describes the R package you use to connect to Oracle.

agency

The default value is 'DFO', the other option is 'NMFS'. Setting to NULL will result in a pick list.

type

This is the 'experiment type', and the default value is 1. For agency='DFO', 5 is also acceptable. For agency = NMFS, 136 is probable, but you can type any integer, and the typed number will be embedded inUSNEFSC.USS_STATION.SHG <= type. Setting to NULL will result in a pick list.

year

The default value is NULL, which will result in a pick list. An example of a valid, non-empty value is 2017.

season

The default value is '', which will result in a pick list. Valid values are 'SUMMER', 'SPRING', 'WINTER', and 'FALL', subject to the availability of data in that season for the selected agency, year, type, etc...

missions

The default value is NULL, which will result in a pick list. An example valid value is c('NED2016016'). If your choice is not valid (given your other selections), you will be presented with a pick list of valid options.

strataTable

The default value is NULL. Depending on your data, other valid values may include: 'GROUNDFISH.GSSTRATUM', 'USNEFSC.DFO5ZJM','USNEFSC.DFO5ZGHNO','USNEFSC.NMFS5ZJM', 'USNEFSC.NMFS5ZGHNO','USNEFSC.NMFS5ZJMC','USNEFSC.NMFS5ZJMU', 'USNEFSC.NMFS5ZU'.

wingspread

This is the width in feet of a standard tow. The default value is 41. Setting this to NULL will result in a pick list.

towDist

This is the length (NM) of a standard tow. The default value is 1.75. Setting this to NULL will result in a pick list.

strata

These are the strata for which you want results. The default value is NULL The DFO SUmmer survey are c(440:495).

areas

These are the areas for which you want results. Some strata can be further broken down by areas, so this allows selection of data within a part of a strata. It can also be set to 'all' or a vector of valid areas (e.g. c('424','511','4xs'))

spp

This is the species code for the species you want to analyze. The default value is NULL, which will result in a pick list. An example of a valid, non-empty value is 2526.

bySex

If the selected species was measured by sex, this parameter allows you to perform calculations by sex. The default value is NULL, which will result in a pick list. An example of a valid, non-empty value is TRUE.

ageBySex

The APL version of stratisfy ignored sex differences in some age results (e.g. 'age by set', 'age mean', 'age total', ' etc.) despite analyses being done by sex. The default value of this parameter is FALSE so that the original results are emulated. However, setting this to TRUE (when bySex=TRUE), will show age results broken down by sex. Setting this to '' will result in a pick list.

useBins

The default value is TRUE. Should data be binned using the length groups from GSPEC?

output

The default value is 'new'. This determines the format of the output Excel file. Setting this to 'classic' will emulate the original APL stratisfy results, including overriding your parameter for ageBySex and forcing it to FALSE. If no excel output is desired, set this parameter to an empty string ''

alkTable

The default is NULL. Setting this to a valid path allows you to add additional values for the age length key.

file_id

This is a modifier you can have appended to the output filename. The resultant file will be called 'Mar_stratisfy<_file_id>.xlsx'

fn.oracle.username

default is '_none_' This is your username for accessing oracle objects. If you have a value for this stored in your environment (e.g. from an rprofile file), this can be left and that value will be used. If a value for this is provided, it will take priority over your existing value.

fn.oracle.password

default is '_none_' This is your password for accessing oracle objects. If you have a value for this stored in your environment (e.g. from an rprofile file), this can be left and that value will be used. If a value for this is provided, it will take priority over your existing value.

fn.oracle.dsn

default is '_none_' This is your dsn/ODBC identifier for accessing oracle objects. If you have a value for this stored in your environment (e.g. from an rprofile file), this can be left and that value will be used. If a value for this is provided, it will take priority over your existing value.

Note

Reports of errors and/or recommendations for improvements should be addressed to: Mike McMahon (Mike.McMahon@dfo-mpo.gc.ca) Fisheries and Oceans Canada

Author(s)

Mike McMahon, Mike.McMahon@dfo-mpo.gc.ca


Maritimes/Mar.stranal documentation built on Sept. 6, 2022, 8:01 p.m.