airdas_comments: Extract comments from AirDAS data

View source: R/airdas_comments.R

airdas_commentsR Documentation

Extract comments from AirDAS data

Description

Extract comments from airdas_dfr or airdas_df object

Usage

airdas_comments(x)

## S3 method for class 'data.frame'
airdas_comments(x)

## S3 method for class 'airdas_df'
airdas_comments(x)

## S3 method for class 'airdas_dfr'
airdas_comments(x)

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.

Value

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

Examples

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"))


swfscAirDAS documentation built on Aug. 9, 2023, 1:06 a.m.