Skip to content

Commit

Permalink
more read_xl
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholascarey committed Mar 29, 2024
1 parent e1fe296 commit d4cf65d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
1 change: 0 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,4 @@ Suggests:
FishResp,
respirometry,
testthat,
readxl,
covr
6 changes: 3 additions & 3 deletions R/import_file.R
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ import_file <- function(path, export = FALSE) {

if (grepl(".xls", path)) {
message("Excel file detected. Only Loligo/Presens Multiplate Excel files currently supported. \nImport will fail for others saved as Excel format. Use raw output files only.")
raw <- suppressMessages(readxl::read_excel(path, n_max = 20))
raw <- suppressMessages(read_excel(path, n_max = 20))
raw <- as.character(raw)
} else if (grepl("gmbl", path)) {
raw <- suppressWarnings(readLines(path))
Expand Down Expand Up @@ -212,11 +212,11 @@ import_file <- function(path, export = FALSE) {
# Loligo/Presens multiplate system ----------------------------------------

parse_multiplate_excel <- function(path, dec = dec){
raw <- suppressMessages(readxl::read_excel(path, col_names = TRUE))
raw <- suppressMessages(read_excel(path, col_names = TRUE))
## which row has "Date/Time"
start_row <- which(grepl("^Date/Time$", raw[[1]]))
## inport from that row on
raw <- suppressMessages(readxl::read_excel(path, skip = start_row - 1))
raw <- suppressMessages(read_excel(path, skip = start_row - 1))
## remove column 27 - empty
raw <- raw[,-27]
out <- data.table(raw)
Expand Down

0 comments on commit d4cf65d

Please sign in to comment.