Skip to content

Commit c6c80da

Browse files
committed
Modified extract_TV80 to handle CSV files with no header present.
1 parent 8882422 commit c6c80da

2 files changed

Lines changed: 11 additions & 4 deletions

File tree

R/trawl.R

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
#' Extract measurements from Simrad TV80 measurement file
22
#'
33
#' @param file The file path, optimally derived using fs::dir_ls().
4+
#' @param col.names `TRUE`, if column names are present. A charactor vector containing column names if not.
5+
#' @param skip.rows Number of rows to skip. 0 if col.name = `TRUE`, 1 if col.names is a character vector.
46
#' @return A data frame with data from the PX sensors, Trawl Eye sensor, and trawl vessel.
57
#' @examples
68
#' extract_tv80("C:/data/TV80/2023/12/11/20231211_142842_measurements.csv")
79
#' @export
810

9-
extract_tv80 <- function(file) {
11+
extract_tv80 <- function(file, col.names = TRUE, skip.rows = 0) {
1012
# Convert file to path to extract file name
11-
file.name <- path_file(as_fs_path(file))
13+
file.name <- fs::path_file(fs::as_fs_path(file))
1214

1315
# Read and format CSV file data
14-
df <- readr::read_delim(file, delim = ";", name_repair = "minimal", lazy = FALSE) %>%
16+
df <- readr::read_delim(file, delim = ";", name_repair = "minimal", lazy = FALSE,
17+
col_names = col.names, skip = skip.rows) %>%
1518
# Remove duplicated columns
1619
dplyr::select(which(!duplicated(names(.)))) %>%
1720
# Format vessel latitude and longitude to decimal degree format

man/extract_tv80.Rd

Lines changed: 5 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)