Skip to content

Commit

Permalink
fix bug where if no results are found an error is thrown trying to rb…
Browse files Browse the repository at this point in the history
…ind empty results
  • Loading branch information
jeanetteclark committed Sep 13, 2024
1 parent 4208ad2 commit 2c582eb
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion R/citation_search.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,13 @@ citation_search <- function(identifiers,
})

# Combine the resulting data frames and return the result df
result <- dplyr::bind_rows(result_df_list)
if (all(sapply(result_df_list, function(x) nrow(x) == 0))) {
# If all data frames are empty, create an empty data frame with the same structure
result <- data.frame()
} else {
# Otherwise, bind the rows
result <- dplyr::bind_rows(result_df_list)
}

return(result)
}
Expand Down

0 comments on commit 2c582eb

Please sign in to comment.