reshapeHRJtolong: (HRJ) Reshape wide formatted HRJ file to long format.

Description Usage Arguments Details Value Examples

Description

In addition to reshaping the wide tables to a long format, age and return year are calculated and the columns included. The data are evaluated for completeness of return year data, by stock. A (Boolean value) column named return.year.complete is included. A third data frame named "workingdata" is created. This consists of data from the 'c' table, which are revised with 'b' data based on the rules outlined in the details section below. The three data frames are also merged with the fishery definition fishery.def and jurisdiction jurisdiction data frames, which add additional meta data columns.

Usage

1
2
reshapeHRJtolong(hrj.list, data.stock, fishery.def.df = NULL,
  jurisdiction.df = NULL)

Arguments

hrj.list

A list comprising data frames of HRJ data in wide format with the same structure as seen in the output from readHRJAccessDatabase.

data.stock

A list. Output from readStockData.

fishery.def.df

A data frame. The default is NULL, and if so the fishery.def data are utilized.

jurisdiction.df

A data frame. The default is NULL, and if so the jurisdiction data are utilized.

Details

The data frame 'workingdata' represents a combination of data from the 'C' and 'B' data frames. The 'C' data frame is used to populate the 'workingdata' data frame. The maximum number of age classes allowed to be missing, by stock and return year, is one. If more than one age class is absent, the 'C' value is replaced by its equivalent "B" value.

The fishery definition fishery.def and jurisdiction jurisdiction data can be accessed by looking to their help file example documentation. If either data frame needs modification, the user can create new data frames with structure matching the two data frames included. The revised data frames can then be used as arguments to reshapeHRJtolong.

Value

A list comprising three elements, all are data frames of the HRJ data tables 'B', 'C', and 'workingdata', in long format.

Examples

1
2
3
4
5
6
## Not run: 
# reading 32 bit mdb files requires using 32bit R
hrj.list.wide <- readHRJAccessDatabase("HRJ_database 2016b.mdb")
hrj.list.long <- reshapeHRJtolong(hrj.list.wide, data.stock)

## End(Not run)

MichaelFolkes/ctctools documentation built on May 7, 2019, 4:56 p.m.