From 0a6ef1d6badfa61d3f3c13ae9b466548bb46c287 Mon Sep 17 00:00:00 2001 From: wkmor1 Date: Wed, 20 Dec 2023 15:32:11 +0200 Subject: [PATCH] Fix removing duplicate field names --- R/finbif_occurrence_load.R | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/R/finbif_occurrence_load.R b/R/finbif_occurrence_load.R index af9ac475..e3bf6c3f 100644 --- a/R/finbif_occurrence_load.R +++ b/R/finbif_occurrence_load.R @@ -271,6 +271,14 @@ finbif_occurrence_load <- function( } + } else { + + select_user_keep <- !duplicated(select[["user"]]) + + select[["user"]] <- select[["user"]][select_user_keep] + + fb_occurrence_df <- fb_occurrence_df[, select_user_keep, drop = FALSE] + } attr(fb_occurrence_df, "file_cols") <- NULL @@ -379,7 +387,6 @@ finbif_occurrence_load <- function( } - select_user <- name_chr_vec(select[["user"]]) fb_occurrence_df <- fb_occurrence_df[, select_user, drop = FALSE] @@ -913,8 +920,6 @@ dt_read <- function(fb_occurrence_obj) { cols <- rownames(cols) - cols <- unique(cols) - if (file.exists(args[["input"]])) { cols <- do.call(data.table::fread, args) @@ -1554,8 +1559,6 @@ open_tsv_connection <- function(connection_obj) { vars <- rownames(vars) - vars <- unique(vars) - vars <- paste0(vars, collapse = "\t") textConnection(vars)