Input data to run(data = ) must be formatted in a certain way to allow calculations such as the creation of the mesh to work. Therefore, all input data frames must be formatted prior to using run(). This function will work detect what kind of data you have and then format it appropriately to work with all downstream functions within this package.

format_data(data, ...)

Arguments

data

A data frame containing tow-level information on catch weight and effort. Additional columns can be present such as depth.

...

Not yet implemented for any of the available methods but present for future development purposes.

Value

A data frame with all lower case column names.

  • year

  • survey_name

  • common_name

  • catch_numbers

  • catch_wt (mt)

  • effort ($km^2$)

  • pass_scaled after subtracting the mean

  • vessel_year pasted together, made numeric, and subtract 1

  • fyear the factor version of year to match notation used in sdmTMB

  • longitude (decimal degrees)

  • latitude (decimal degrees)

  • x and y are in Universal Transverse Mercator (UTM)

  • depth (m) with positive entries representing measurements above sea level and negative entries representing measurements below sea level

  • depth_scaled depth (m) scaled using base::scale(); so, subtracting the mean and dividing by the standard deviation, these values are saved in attributes for this column so that you can reference them later

  • depth_scaled_squared is depth_scaled^2

Author

Chantel R. Wetzel and Kelli F. Johnson

Examples

catch_wcgbts_canary <- nwfscSurvey::pull_catch(
  common_name = "canary rockfish",
  years = 2021:2022,
  survey = "NWFSC.Combo"
)
#>  Output will not be saved in dir because dir = NULL.
#>  Pulling catch data for canary rockfish.
#> There are 109 positive tows across all years pulled.
#>  There were 5 positive tows with non-satisfactory tow performance (e.g., no area swept estimate, net issues, etc.).
#> There are 104 positive tows remaining across all years after standard
#> filtering.
# Must assign the data a class so {indexwc} knows how to format it
class(catch_wcgbts_canary) <- c("nwfscSurvey", class(catch_wcgbts_canary))
formatted_data <- format_data(data = catch_wcgbts_canary)