Check that AirDAS file has accepted formatting and values
Usage
airdas_check(
file,
file.type = c("turtle", "caretta", "phocoena"),
skip = 0,
file.out = NULL,
sp.codes.file = NULL,
sp.codes.skip = 3,
print.transect = TRUE
)
Arguments
- file
filename(s) of one or more AirDAS files
- file.type
character; indicates the program used to create
file
. Must be one of: "turtle", "caretta", "survey", or "phocoena" (case sensitive). Default is "turtle". Passed toairdas_read()
- skip
integer: see
readr::read_fwf()
. Default is 0. Passed toairdas_read()
- file.out
character; filename to which to write the error log. Should be a text or CSV file. Default is
NULL
- sp.codes.file
character; default is
NULL
. Filename of the SpCodes file from which to read the species codes. IfNULL
, the default (internal) file will be used. The SpCodes file will be read byairdas_spcodes_read()
- sp.codes.skip
integer; default is 3. Passed directly to
skip
argument ofairdas_spcodes_read()
- print.transect
logical; indicates if a table with all the transect numbers in the
x
should be printed usingbase::table()
. Default isTRUE
Value
A data frame with five columns that list information about errors
found in the AirDAS files: the file name, line number, index (row number)
from the airdas_read(file)
data frame, 'ID' (pre-Data# columns from
the DAS file), and description of the issue. This data frame is sorted by the
'Description' column. If there are multiple issues with the same line, the
issue descriptions are concatenated together using
paste(..., collapse = "; ")
If print.transect
is TRUE
, then the output of
table(x$Data1[x$Event == "T"], useNA = "always")
, where x
is
the output of airdas_read(file, ...)
is printed
If file.out
is not NULL
, then the error log is also written to
the file (e.g., a .txt or .csv file) specified by file.out
Details
The default (internal) sp.codes
file is located at
system.file("extdata", "SpCodesAirDAS.dat", package = "swfscAirDAS")
.
To see the checks performed by this function, you can access the PDF locally
at system.file("AirDAS_check.pdf", package = "swfscAirDAS")
, or online
at https://github.com/swfsc/swfscAirDAS/blob/master/inst/AirDAS_check.pdf
Checks that are not done by this function that may be of interest:
Check for valid fish ball/mola/jelly/crab pot codes
Check that datetimes are sequential, meaning they 1) are the same as or 2) come after the previous event
Examples
y <- system.file("extdata", "airdas_sample.das", package = "swfscAirDAS")
if (interactive()) airdas_check(y, print.transect = TRUE)
# Replace system.file... with path to your SpCodes file
sp.codes.file <- system.file("extdata", "SpCodesAirDAS.DAT", package = "swfscAirDAS")
if (interactive()) airdas_check(y, sp.codes.file = sp.codes.file)