swfscDAS (version 0.4.0)

das_read: Read DAS file(s)

Description

Read one or more fixed-width DAS text file(s) generated by WinCruz into a data frame, where each line is data for a specific event

Usage

das_read(file, skip = 0, tz = "UTC", ...)

Arguments

file

filename(s) of one or more DAS files

skip

integer; see read_fwf. Default is 0

tz

character; see strptime. Default is "UTC"

...

ignored

Value

A das_dfr object, which is also a data frame, with DAS data read into columns. The data are read into the data frame as characters as described in 'Details', with the following exceptions:

Name Class Details
EffortDot logical TRUE if "." was present, and FALSE otherwise
DateTime POSIXct combination of 'Date' and 'Time' columns with time zone tz
Lat numeric 'Latitude' column converted to decimal degrees in range [-90, 90]
Lon numeric 'Longitude' column converted to decimal degrees in range [-180, 180]
Data# character leading/trailing whitespace trimmed for non-comment events (i.e. where 'Event' is not "C")
EventNum character leading/trailing whitespace trimmed; left as character for some project-specific codes
file_das character base filename, extracted from the file argument
line_num integer line number of each data row

Warnings are printed if any unexpected events have NA DateTime/Lat/Lon values, or if any Lat/Lon values cannot be converted to numeric values. Events that are 'expected' to have NA DateTime/Lat/Lon values are: C, ?, 1, 2, 3, 4, 5, 6, 7, 8

Details

Reads/parses DAS data into columns of a data frame. If file contains multiple filenames, then the individual data frames will be concatenated.

The provided DAS file must adhere to the following column number and format specifications:

Item Columns Format
Event number 1-3 Event
4 Effort dot 5
Time 6-11 HHMMSS or HHMM
Date 13-18 MMDDYY
Latitude 20-28 NDD:MM.MM
Longitude 30-39 WDDD:MM.MM
Data1 40-44 Data2
45-49 Data3 50-54
Data4 55-59 Data5
60-64 Data6 65-69
Data7 70-74 Data8
75-79 Data9 80-84
Data10 85-89 Data11
90-94 Data12 95+

See das_format_pdf for more information about DAS format requirements, and note that 'Data#' columns may be referred to as 'Field#' columns in other documentation This function was inspired by das.read

Examples

Run this code
# NOT RUN {
y <- system.file("das_sample.das", package = "swfscDAS")
das_read(y)

# }

Run the code above in your browser using DataLab