Skip to content

Commit

Permalink
Update bind_databases.R
Browse files Browse the repository at this point in the history
  • Loading branch information
ehwenk committed Nov 11, 2024
1 parent 052bf47 commit eb07fe8
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions R/bind_databases.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,14 @@
#' @return Compiled database as a single large list
#' @importFrom rlang .data
#' @export
bind_databases <- function(..., databases = list(...)) {
bind_databases <- function(database_1, ...) {

# List of databases to combine
databases = list(database_1, ...)

# Capture names of databases input; required below to assign names to databases in list
database_names <- match.call() %>% as.character()
database_names <- database_names[-1]

combine <- function(name, databases) {
dplyr::bind_rows(lapply(databases, "[[", name)) %>% dplyr::distinct()
Expand All @@ -28,8 +35,11 @@ bind_databases <- function(..., databases = list(...)) {
# Drop null datasets
databases[sapply(databases, is.null)] <- NULL

# XX - TODO - I think this line of code needs to change
names(databases) <- sapply(databases, "[[", "dataset_id")
# Assign names to databases
names(databases) <- database_names
# This is the initial code used in traits.build, where the names of the individual databases
# were always dataset_id's
#names(databases) <- sapply(databases, "[[", database_names)

# Taxonomy

Expand Down

0 comments on commit eb07fe8

Please sign in to comment.