Learn R Programming

swfscAirDAS (version 0.3.1)

airdas_comments: Extract comments from AirDAS data

Description

Extract comments from airdas_dfr or airdas_df object

Usage

airdas_comments(x)

# S3 method for data.frame airdas_comments(x)

# S3 method for airdas_df airdas_comments(x)

# S3 method for airdas_dfr airdas_comments(x)

Value

x, filtered for C events and with the added column comment_str containing the concatenated comment strings

Arguments

x

airdas_dfr or airdas_df object, or a data frame that can be coerced to a airdas_dfr object

Details

This function recreates the comment strings by pasting the Data# columns back together for the C events (comments)

See the examples section for how to search for comments with the phrase "record" to determine what extra information (e.g. molas) was being recorded vs ignored.

Examples

Run this code
y <- system.file("airdas_sample.das", package = "swfscAirDAS")
y.read <- airdas_read(y, file.type = "turtle")

airdas_comments(y.read)

# Extract all comments containing "record"
y.comm <- airdas_comments(y.read)
y.comm[grepl("record", y.comm$comment_str, ignore.case = TRUE), ]

# Extract all comments containing "record", but not "recorder"
y.comm <- airdas_comments(y.read)
y.comm[grepl("record", y.comm$comment_str, ignore.case = TRUE) & 
         !grepl("recorder", y.comm$comment_str, ignore.case = TRUE), ]
         
# Join comments with processed data
dplyr::left_join(y.read, y.comm[, c("file_das", "line_num", "comment_str")],
                 by = c("file_das", "line_num"))

Run the code above in your browser using DataLab