das_check {swfscDAS}R Documentation

Check DAS file

Description

Check that DAS file has accepted formatting and values

Usage

das_check(
  file,
  skip = 0,
  file.out = NULL,
  sp.codes = NULL,
  print.cruise.nums = TRUE
)

Arguments

file

filename(s) of one or more DAS files

skip

integer: see read_fwf. Default is 0

file.out

filename to which to write the error log; default is NULL

sp.codes

character; filename of .dat file from which to read accepted species codes. If NULL, species codes will not be checked. Default is NULL

print.cruise.nums

logical; indicates if a table with all the cruise numbers in the x should be printed using table. Default is TRUE

Details

Precursor to a more comprehensive DASCHECK program. This function checks that the following is true:

Item Event Column Requirement
Cruise number B Data1 Can be converted to a numeric value
Mode B Data2 Must be one of C, P, c, p, or NA (blank)
Echo sounder B Data4 Must be one of Y, N, y, n, or NA (blank)
Effort type R Data1 Must be one of F, N, S, or NA (blank)
ESW sides R Data2 Effective strip width; must be one of F, H, or NA (blank)
Course N Data1 Can be converted to a numeric value
Speed N Data2 Can be converted to a numeric value
Beaufort V Data1 Must be a whole number between 0 and 9
Swell height V Data2 Can be converted to a numeric value
Wind speed V Data5 Can be converted to a numeric value
Rain or fog W Data1 Must be between 0 and 5 and either a whole number or have decimal value .5
Horizontal sun W Data2 Must be a whole number between 0 and 12
Vertical sun W Data3 Must be a whole number between 0 and 12
Visibility W Data5 Can be converted to a numeric value
Sighting (mammal) S, K, M Data3-7 Can be converted to a numeric value
Sighting (mammal) G Data5-7 Can be converted to a numeric value
Sighting cue (mammal) S, K, M Data3 Must be a whole number between 1 and 6
Sighting method (mammal) S, K, M, G Data4 Must be a whole number between 1 and 7
Bearing (mammal) S, K, M, G Data5 Must be a whole number between 0 and 360
Photos A Data3 Must be one of N, Y, n, y, or NA (blank)
Birds A Data4 Must be one of N, Y, n, y, or NA (blank)
Calibration school S, K, M Data10 Must be one of N, Y, n, y, or NA (blank)
Aerial photos taken S, K, M Data11 Must be one of N, Y, n, y, or NA (blank)
Biopsy taken S, K, M Data12 Must be one of N, Y, n, y, or NA (blank)
Species codes A Data5-8 If a species codes file is provided, must be one of the provided codes
Resight s, k Data2-5 Can be converted to a numeric value
Turtle species t Data2 If a species codes file is provided, must be one of the provided codes
Turtle sighting t Data3-5, 7 Can be converted to a numeric value
Turtle JFR t Data6 Must be one of F, J, N, R, or NA (blank)
Fishing vessel F Data2-4 Can be converted to a numeric value
Sighting info 1-8 Data2-8 Can be converted to a numeric value
Sighting info 1-8 Data9 The Data9 column must be NA (blank) for events 1-8

In the table above, 'between' means inclusive.

Long-term items, and checks that are not performed:

Value

A data frame with columns: the file name, line number, cruise number, 'ID' (columns 4-39 from the DAS file), and description of the issue

If file.out is not NULL, then the error log data frame is also written to file.out using write.csv

A warning is printed if any events are r events; see das_process for details about r events

Examples

y <- system.file("das_sample.das", package = "swfscDAS")
if (interactive()) das_check(y)


[Package swfscDAS version 0.6.3 Index]