Skip to content

Commit

Permalink
speed up condense_data()
Browse files Browse the repository at this point in the history
  • Loading branch information
wlandau committed Jan 7, 2025
1 parent 646c267 commit 0ce266a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion R/class_database.R
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,12 @@ database_class <- R6::R6Class(
lookup_list(.subset2(self, "lookup"))
},
condense_data = function(data) {
data[!duplicated(data$name, fromLast = TRUE), ]
repeats <- duplicated(data$name, fromLast = TRUE)
if (any(repeats)) {
data[!repeats, ]
} else {
data
}
},
read_condensed_data = function() {
self$condense_data(self$read_data())
Expand Down

0 comments on commit 0ce266a

Please sign in to comment.