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)
Value
x
, filtered for C events and with the added column
comment_str containing the concatenated comment strings
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
y <- system.file("airdas_sample.das", package = "swfscAirDAS")
y.read <- airdas_read(y, file.type = "turtle")
airdas_comments(y.read)
#> Event EffortDot DateTime Lat Lon Data1 Data2 Data3
#> 1 C FALSE 2015-04-09 12:30:59 39.23550 -123.1563 Reco rder: dd
#> 2 C FALSE 2015-04-09 12:30:59 39.23550 -123.1563 Not recor ding
#> 11 C TRUE 2015-04-09 12:31:48 39.23350 -123.1857 2 cp <NA> <NA>
#> 22 C TRUE 2015-04-09 12:34:56 39.23317 -123.2968 stre aky r ed ti
#> 25 C TRUE 2015-04-09 12:35:32 39.23317 -123.3178 shar k 11f t
#> 38 C FALSE 2015-04-09 12:38:00 39.23400 -123.4047 off effor t to
#> 42 C TRUE 2015-04-09 12:40:36 39.23317 -123.4960 wate r got more
#> 46 C TRUE 2015-04-09 12:42:01 39.23267 -123.5433 fb2s fb1m <NA>
#> 73 C TRUE 2015-04-09 12:52:39 39.21700 -123.4072 bell y has some
#> 84 C TRUE 2015-04-09 12:56:43 39.21717 -123.2718 patc hy re d tid
#> Data4 Data5 Data6 Data7 EventNum file_das line_num
#> 1 <NA> <NA> <NA> <NA> 1 airdas_sample.das 1
#> 2 molas <NA> <NA> <NA> 2 airdas_sample.das 2
#> 11 <NA> <NA> <NA> <NA> 11 airdas_sample.das 11
#> 22 de <NA> <NA> <NA> 21 airdas_sample.das 22
#> 25 <NA> <NA> <NA> <NA> 24 airdas_sample.das 25
#> 38 circl e on unide ntifed object 37 airdas_sample.das 38
#> 42 blue <NA> <NA> <NA> 41 airdas_sample.das 42
#> 46 <NA> <NA> <NA> <NA> 45 airdas_sample.das 46
#> 73 glar e <NA> <NA> 72 airdas_sample.das 73
#> 84 e <NA> <NA> <NA> 83 airdas_sample.das 84
#> file_type comment_str
#> 1 turtle Recorder: dd
#> 2 turtle Not recording molas
#> 11 turtle 2 cp
#> 22 turtle streaky red tide
#> 25 turtle shark 11ft
#> 38 turtle off effort to circle on unidentifed object
#> 42 turtle water got more blue
#> 46 turtle fb2s fb1m
#> 73 turtle belly has some glare
#> 84 turtle patchy red tide
# Extract all comments containing "record"
y.comm <- airdas_comments(y.read)
y.comm[grepl("record", y.comm$comment_str, ignore.case = TRUE), ]
#> Event EffortDot DateTime Lat Lon Data1 Data2 Data3 Data4
#> 1 C FALSE 2015-04-09 12:30:59 39.2355 -123.1563 Reco rder: dd <NA>
#> 2 C FALSE 2015-04-09 12:30:59 39.2355 -123.1563 Not recor ding molas
#> Data5 Data6 Data7 EventNum file_das line_num file_type
#> 1 <NA> <NA> <NA> 1 airdas_sample.das 1 turtle
#> 2 <NA> <NA> <NA> 2 airdas_sample.das 2 turtle
#> comment_str
#> 1 Recorder: dd
#> 2 Not recording molas
# 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), ]
#> Event EffortDot DateTime Lat Lon Data1 Data2 Data3 Data4
#> 2 C FALSE 2015-04-09 12:30:59 39.2355 -123.1563 Not recor ding molas
#> Data5 Data6 Data7 EventNum file_das line_num file_type
#> 2 <NA> <NA> <NA> 2 airdas_sample.das 2 turtle
#> comment_str
#> 2 Not recording molas
# 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"))
#> Event EffortDot DateTime Lat Lon Data1 Data2 Data3
#> 1 C FALSE 2015-04-09 12:30:59 39.23550 -123.1563 Reco rder: dd
#> 2 C FALSE 2015-04-09 12:30:59 39.23550 -123.1563 Not recor ding
#> 3 T TRUE 2015-04-09 12:30:59 39.23550 -123.1563 T1 <NA> <NA>
#> 4 V TRUE 2015-04-09 12:30:59 39.23550 -123.1563 g g g
#> 5 P TRUE 2015-04-09 12:30:59 39.23550 -123.1563 aa bb cc
#> 6 A TRUE 2015-04-09 12:30:59 39.23550 -123.1563 650 100 <NA>
#> 7 W TRUE 2015-04-09 12:30:59 39.23550 -123.1563 n 10 1
#> 8 * TRUE 2015-04-09 12:31:00 39.23567 -123.1575 <NA> <NA> <NA>
#> 9 S TRUE 2015-04-09 12:31:35 39.23367 -123.1783 1 cc 67
#> 10 S TRUE 2015-04-09 12:31:47 39.23350 -123.1857 2 bb -60
#> 11 C TRUE 2015-04-09 12:31:48 39.23350 -123.1857 2 cp <NA> <NA>
#> 12 S TRUE 2015-04-09 12:31:56 39.23333 -123.1917 3 cc 38
#> 13 * TRUE 2015-04-09 12:32:00 39.23317 -123.1930 <NA> <NA> <NA>
#> 14 S TRUE 2015-04-09 12:32:20 39.23233 -123.2053 4 aa -50
#> 15 S TRUE 2015-04-09 12:32:30 39.23233 -123.2108 5 cc 49
#> 16 S TRUE 2015-04-09 12:32:42 39.23233 -123.2195 6 cc 42
#> 17 1 FALSE <NA> NA NA <NA> <NA> <NA>
#> 18 * TRUE 2015-04-09 12:33:00 39.23267 -123.2292 <NA> <NA> <NA>
#> 19 S TRUE 2015-04-09 12:33:43 39.23333 -123.2550 7 aa -53
#> 20 * TRUE 2015-04-09 12:34:00 39.23300 -123.2637 <NA> <NA> <NA>
#> 21 W TRUE 2015-04-09 12:34:52 39.23317 -123.2945 r 10 1
#> 22 C TRUE 2015-04-09 12:34:56 39.23317 -123.2968 stre aky r ed ti
#> 23 * TRUE 2015-04-09 12:35:00 39.23317 -123.2985 <NA> <NA> <NA>
#> 24 S TRUE 2015-04-09 12:35:13 39.23317 -123.3073 8 dd 24
#> 25 C TRUE 2015-04-09 12:35:32 39.23317 -123.3178 shar k 11f t
#> 26 * TRUE 2015-04-09 12:36:00 39.23333 -123.3337 <NA> <NA> <NA>
#> 27 S TRUE 2015-04-09 12:36:13 39.23333 -123.3418 9 aa -57
#> 28 S TRUE 2015-04-09 12:36:26 39.23350 -123.3500 10 cc 65
#> 29 t TRUE 2015-04-09 12:36:26 39.23350 -123.3500 aa -20 dc
#> 30 S TRUE 2015-04-09 12:36:43 39.23350 -123.3592 11 bb 87
#> 31 * TRUE 2015-04-09 12:37:01 39.23383 -123.3685 <NA> <NA> <NA>
#> 32 S TRUE 2015-04-09 12:37:01 39.23400 -123.3697 12 bb 82
#> 33 S TRUE 2015-04-09 12:37:16 39.23433 -123.3790 13 bb 54
#> 34 # TRUE 2015-04-09 12:37:17 39.23433 -123.3790 <NA> <NA> <NA>
#> 35 S TRUE 2015-04-09 12:37:37 39.23417 -123.3910 14 cc 62
#> 36 W TRUE 2015-04-09 12:37:57 39.23400 -123.4033 n 10 2
#> 37 E FALSE 2015-04-09 12:38:00 39.23400 -123.4047 <NA> <NA> <NA>
#> 38 C FALSE 2015-04-09 12:38:00 39.23400 -123.4047 off effor t to
#> 39 * FALSE 2015-04-09 12:39:00 39.23417 -123.4400 <NA> <NA> <NA>
#> 40 R TRUE 2015-04-09 12:40:00 39.23400 -123.4742 <NA> <NA> <NA>
#> 41 W TRUE 2015-04-09 12:40:28 39.23333 -123.4915 n 20 2
#> 42 C TRUE 2015-04-09 12:40:36 39.23317 -123.4960 wate r got more
#> 43 * TRUE 2015-04-09 12:41:00 39.23317 -123.5092 <NA> <NA> <NA>
#> 44 W TRUE 2015-04-09 12:41:08 39.23317 -123.5143 n 20 1
#> 45 * TRUE 2015-04-09 12:42:00 39.23267 -123.5433 <NA> <NA> <NA>
#> 46 C TRUE 2015-04-09 12:42:01 39.23267 -123.5433 fb2s fb1m <NA>
#> 47 S TRUE 2015-04-09 12:42:13 39.23250 -123.5515 15 bb 50
#> 48 * TRUE 2015-04-09 12:43:00 39.23233 -123.5778 <NA> <NA> <NA>
#> 49 O FALSE 2015-04-09 12:43:43 39.23283 -123.6033 <NA> <NA> <NA>
#> 50 * FALSE 2015-04-09 12:44:00 39.23300 -123.6118 <NA> <NA> <NA>
#> 51 * FALSE 2015-04-09 12:45:00 39.24450 -123.6415 <NA> <NA> <NA>
#> 52 * FALSE 2015-04-09 12:46:00 39.22167 -123.6373 <NA> <NA> <NA>
#> 53 T TRUE 2015-04-09 12:46:51 39.22000 -123.6078 T2 <NA> <NA>
#> 54 V TRUE 2015-04-09 12:46:51 39.22000 -123.6078 g g g
#> 55 P TRUE 2015-04-09 12:46:51 39.22000 -123.6078 aa dd cc
#> 56 A TRUE 2015-04-09 12:46:51 39.22000 -123.6078 650 100 <NA>
#> 57 W TRUE 2015-04-09 12:46:51 39.22000 -123.6078 n 20 1
#> 58 * TRUE 2015-04-09 12:47:00 39.21950 -123.6025 <NA> <NA> <NA>
#> 59 * TRUE 2015-04-09 12:48:00 39.21783 -123.5682 <NA> <NA> <NA>
#> 60 A TRUE 2015-04-09 12:48:29 39.21767 -123.5515 680 100 <NA>
#> 61 A TRUE 2015-04-09 12:48:36 39.21783 -123.5468 650 100 <NA>
#> 62 * TRUE 2015-04-09 12:49:00 39.21783 -123.5333 <NA> <NA> <NA>
#> 63 * TRUE 2015-04-09 12:50:00 39.21617 -123.4987 <NA> <NA> <NA>
#> 64 A TRUE 2015-04-09 12:50:32 39.21683 -123.4797 680 90 <NA>
#> 65 * TRUE 2015-04-09 12:51:00 39.21733 -123.4653 <NA> <NA> <NA>
#> 66 S TRUE 2015-04-09 12:51:40 39.21750 -123.4410 16 aa -31
#> 67 S TRUE 2015-04-09 12:51:55 39.21750 -123.4317 17 bb -59
#> 68 * TRUE 2015-04-09 12:52:00 39.21733 -123.4293 <NA> <NA> <NA>
#> 69 S TRUE 2015-04-09 12:52:03 39.21733 -123.4270 18 aa -62
#> 70 S TRUE 2015-04-09 12:52:04 39.21733 -123.4270 19 cc 42
#> 71 S TRUE 2015-04-09 12:52:07 39.21733 -123.4258 20 aa -48
#> 72 S TRUE 2015-04-09 12:52:17 39.21700 -123.4185 21 cc 63
#> 73 C TRUE 2015-04-09 12:52:39 39.21700 -123.4072 bell y has some
#> 74 S TRUE 2015-04-09 12:52:54 39.21700 -123.3982 22 cc 43
#> 75 * TRUE 2015-04-09 12:53:00 39.21717 -123.3960 <NA> <NA> <NA>
#> 76 * TRUE 2015-04-09 12:54:00 39.21683 -123.3617 <NA> <NA> <NA>
#> 77 V TRUE 2015-04-09 12:54:01 39.21683 -123.3605 g g p
#> 78 W TRUE 2015-04-09 12:54:04 39.21683 -123.3605 n 20 2
#> 79 S TRUE 2015-04-09 12:54:34 39.21667 -123.3422 23 cc 56
#> 80 * TRUE 2015-04-09 12:55:00 39.21667 -123.3285 <NA> <NA> <NA>
#> 81 S TRUE 2015-04-09 12:55:20 39.21700 -123.3172 24 cc 37
#> 82 * TRUE 2015-04-09 12:56:00 39.21700 -123.2960 <NA> <NA> <NA>
#> 83 W TRUE 2015-04-09 12:56:40 39.21733 -123.2730 r 20 2
#> 84 C TRUE 2015-04-09 12:56:43 39.21717 -123.2718 patc hy re d tid
#> 85 S TRUE 2015-04-09 12:56:49 39.21717 -123.2685 25 bb -76
#> 86 * TRUE 2015-04-09 12:57:00 39.21700 -123.2617 <NA> <NA> <NA>
#> 87 s TRUE 2015-04-09 12:57:00 39.21700 -123.2617 25 -70 <NA>
#> 88 O FALSE 2015-04-09 12:57:30 39.21700 -123.2417 <NA> <NA> <NA>
#> Data4 Data5 Data6 Data7 EventNum file_das line_num
#> 1 <NA> <NA> <NA> <NA> 1 airdas_sample.das 1
#> 2 molas <NA> <NA> <NA> 2 airdas_sample.das 2
#> 3 <NA> <NA> <NA> <NA> 3 airdas_sample.das 3
#> 4 g g <NA> <NA> 4 airdas_sample.das 4
#> 5 dd <NA> <NA> <NA> 5 airdas_sample.das 5
#> 6 <NA> <NA> <NA> <NA> 6 airdas_sample.das 6
#> 7 0 6 <NA> <NA> 7 airdas_sample.das 7
#> 8 <NA> <NA> <NA> <NA> 8 airdas_sample.das 8
#> 9 6 mn <NA> <NA> 9 airdas_sample.das 9
#> 10 6 mn <NA> <NA> 10 airdas_sample.das 10
#> 11 <NA> <NA> <NA> <NA> 11 airdas_sample.das 11
#> 12 2 mn <NA> <NA> 12 airdas_sample.das 12
#> 13 <NA> <NA> <NA> <NA> 13 airdas_sample.das 13
#> 14 5 mn <NA> <NA> 14 airdas_sample.das 14
#> 15 4 bm <NA> <NA> 15 airdas_sample.das 15
#> 16 10 gg er <NA> 16 airdas_sample.das 16
#> 17 <NA> 80 20 <NA> <NA> airdas_sample.das 17
#> 18 <NA> <NA> <NA> <NA> 17 airdas_sample.das 18
#> 19 5 bm <NA> <NA> 18 airdas_sample.das 19
#> 20 <NA> <NA> <NA> <NA> 19 airdas_sample.das 20
#> 21 2 6 <NA> <NA> 20 airdas_sample.das 21
#> 22 de <NA> <NA> <NA> 21 airdas_sample.das 22
#> 23 <NA> <NA> <NA> <NA> 22 airdas_sample.das 23
#> 24 2 bm <NA> <NA> 23 airdas_sample.das 24
#> 25 <NA> <NA> <NA> <NA> 24 airdas_sample.das 25
#> 26 <NA> <NA> <NA> <NA> 25 airdas_sample.das 26
#> 27 4 mn <NA> <NA> 26 airdas_sample.das 27
#> 28 5 gg <NA> <NA> 27 airdas_sample.das 28
#> 29 5 90 n <NA> 28 airdas_sample.das 29
#> 30 3 pp <NA> <NA> 29 airdas_sample.das 30
#> 31 <NA> <NA> <NA> <NA> 30 airdas_sample.das 31
#> 32 5 gg <NA> <NA> 31 airdas_sample.das 32
#> 33 6 pp <NA> <NA> 32 airdas_sample.das 33
#> 34 <NA> <NA> <NA> <NA> 33 airdas_sample.das 34
#> 35 2 gg <NA> <NA> 34 airdas_sample.das 35
#> 36 0 6 <NA> <NA> 35 airdas_sample.das 36
#> 37 <NA> <NA> <NA> <NA> 36 airdas_sample.das 37
#> 38 circl e on unide ntifed object 37 airdas_sample.das 38
#> 39 <NA> <NA> <NA> <NA> 38 airdas_sample.das 39
#> 40 <NA> <NA> <NA> <NA> 39 airdas_sample.das 40
#> 41 0 6 <NA> <NA> 40 airdas_sample.das 41
#> 42 blue <NA> <NA> <NA> 41 airdas_sample.das 42
#> 43 <NA> <NA> <NA> <NA> 42 airdas_sample.das 43
#> 44 0 6 <NA> <NA> 43 airdas_sample.das 44
#> 45 <NA> <NA> <NA> <NA> 44 airdas_sample.das 45
#> 46 <NA> <NA> <NA> <NA> 45 airdas_sample.das 46
#> 47 3 mn <NA> <NA> 46 airdas_sample.das 47
#> 48 <NA> <NA> <NA> <NA> 47 airdas_sample.das 48
#> 49 <NA> <NA> <NA> <NA> 48 airdas_sample.das 49
#> 50 <NA> <NA> <NA> <NA> 49 airdas_sample.das 50
#> 51 <NA> <NA> <NA> <NA> 50 airdas_sample.das 51
#> 52 <NA> <NA> <NA> <NA> 51 airdas_sample.das 52
#> 53 <NA> <NA> <NA> <NA> 52 airdas_sample.das 53
#> 54 g g <NA> <NA> 53 airdas_sample.das 54
#> 55 bb <NA> <NA> <NA> 54 airdas_sample.das 55
#> 56 <NA> <NA> <NA> <NA> 55 airdas_sample.das 56
#> 57 0 12 <NA> <NA> 56 airdas_sample.das 57
#> 58 <NA> <NA> <NA> <NA> 57 airdas_sample.das 58
#> 59 <NA> <NA> <NA> <NA> 58 airdas_sample.das 59
#> 60 <NA> <NA> <NA> <NA> 59 airdas_sample.das 60
#> 61 <NA> <NA> <NA> <NA> 60 airdas_sample.das 61
#> 62 <NA> <NA> <NA> <NA> 61 airdas_sample.das 62
#> 63 <NA> <NA> <NA> <NA> 62 airdas_sample.das 63
#> 64 <NA> <NA> <NA> <NA> 63 airdas_sample.das 64
#> 65 <NA> <NA> <NA> <NA> 64 airdas_sample.das 65
#> 66 6 mn <NA> <NA> 65 airdas_sample.das 66
#> 67 6 bm <NA> <NA> 66 airdas_sample.das 67
#> 68 <NA> <NA> <NA> <NA> 67 airdas_sample.das 68
#> 69 2 gg <NA> <NA> 68 airdas_sample.das 69
#> 70 3 bm <NA> <NA> 69 airdas_sample.das 70
#> 71 4 bm <NA> <NA> 70 airdas_sample.das 71
#> 72 6 pp <NA> <NA> 71 airdas_sample.das 72
#> 73 glar e <NA> <NA> 72 airdas_sample.das 73
#> 74 2 pp <NA> <NA> 73 airdas_sample.das 74
#> 75 <NA> <NA> <NA> <NA> 74 airdas_sample.das 75
#> 76 <NA> <NA> <NA> <NA> 75 airdas_sample.das 76
#> 77 g g <NA> <NA> 76 airdas_sample.das 77
#> 78 0 12 <NA> <NA> 77 airdas_sample.das 78
#> 79 6 mn <NA> <NA> 78 airdas_sample.das 79
#> 80 <NA> <NA> <NA> <NA> 79 airdas_sample.das 80
#> 81 6 mn <NA> <NA> 80 airdas_sample.das 81
#> 82 <NA> <NA> <NA> <NA> 81 airdas_sample.das 82
#> 83 0 12 <NA> <NA> 82 airdas_sample.das 83
#> 84 e <NA> <NA> <NA> 83 airdas_sample.das 84
#> 85 1 pp <NA> <NA> 84 airdas_sample.das 85
#> 86 <NA> <NA> <NA> <NA> 85 airdas_sample.das 86
#> 87 <NA> <NA> <NA> <NA> 86 airdas_sample.das 87
#> 88 <NA> <NA> <NA> <NA> 87 airdas_sample.das 88
#> file_type comment_str
#> 1 turtle Recorder: dd
#> 2 turtle Not recording molas
#> 3 turtle <NA>
#> 4 turtle <NA>
#> 5 turtle <NA>
#> 6 turtle <NA>
#> 7 turtle <NA>
#> 8 turtle <NA>
#> 9 turtle <NA>
#> 10 turtle <NA>
#> 11 turtle 2 cp
#> 12 turtle <NA>
#> 13 turtle <NA>
#> 14 turtle <NA>
#> 15 turtle <NA>
#> 16 turtle <NA>
#> 17 turtle <NA>
#> 18 turtle <NA>
#> 19 turtle <NA>
#> 20 turtle <NA>
#> 21 turtle <NA>
#> 22 turtle streaky red tide
#> 23 turtle <NA>
#> 24 turtle <NA>
#> 25 turtle shark 11ft
#> 26 turtle <NA>
#> 27 turtle <NA>
#> 28 turtle <NA>
#> 29 turtle <NA>
#> 30 turtle <NA>
#> 31 turtle <NA>
#> 32 turtle <NA>
#> 33 turtle <NA>
#> 34 turtle <NA>
#> 35 turtle <NA>
#> 36 turtle <NA>
#> 37 turtle <NA>
#> 38 turtle off effort to circle on unidentifed object
#> 39 turtle <NA>
#> 40 turtle <NA>
#> 41 turtle <NA>
#> 42 turtle water got more blue
#> 43 turtle <NA>
#> 44 turtle <NA>
#> 45 turtle <NA>
#> 46 turtle fb2s fb1m
#> 47 turtle <NA>
#> 48 turtle <NA>
#> 49 turtle <NA>
#> 50 turtle <NA>
#> 51 turtle <NA>
#> 52 turtle <NA>
#> 53 turtle <NA>
#> 54 turtle <NA>
#> 55 turtle <NA>
#> 56 turtle <NA>
#> 57 turtle <NA>
#> 58 turtle <NA>
#> 59 turtle <NA>
#> 60 turtle <NA>
#> 61 turtle <NA>
#> 62 turtle <NA>
#> 63 turtle <NA>
#> 64 turtle <NA>
#> 65 turtle <NA>
#> 66 turtle <NA>
#> 67 turtle <NA>
#> 68 turtle <NA>
#> 69 turtle <NA>
#> 70 turtle <NA>
#> 71 turtle <NA>
#> 72 turtle <NA>
#> 73 turtle belly has some glare
#> 74 turtle <NA>
#> 75 turtle <NA>
#> 76 turtle <NA>
#> 77 turtle <NA>
#> 78 turtle <NA>
#> 79 turtle <NA>
#> 80 turtle <NA>
#> 81 turtle <NA>
#> 82 turtle <NA>
#> 83 turtle <NA>
#> 84 turtle patchy red tide
#> 85 turtle <NA>
#> 86 turtle <NA>
#> 87 turtle <NA>
#> 88 turtle <NA>