Skip to content

Commit

Permalink
implement warning for duplicated filename_timestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
philipp-baumann committed May 7, 2023
1 parent 61dc881 commit 148b383
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions R/read_opus.R
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,17 @@ read_opus <- function(dsn,
dataset_list, function(x) attr(x, "filename_timestamp"),
FUN.VALUE = character(1))

warning_duplicated_filename_timestamp <- getOption(
"warning_duplicated_filename_timestamp", default = TRUE)

if (warning_duplicated_filename_timestamp) {
files_duplicated <- unique(
filenames_timestamps[duplicated(filenames_timestamps)])
warning_msg <- paste0("Reading duplicated files:\n",
paste0(files_duplicated, collapse = "\n"))
warning(warning_msg, call. = FALSE)
}

names(dataset_list) <- filenames_timestamps

return(dataset_list)
Expand Down

0 comments on commit 148b383

Please sign in to comment.