Skip to content

Commit afba3f4

Browse files
committed
Handle issue around ambiguous element classes
1 parent 1236117 commit afba3f4

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

R/chembl.R

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -651,8 +651,12 @@ format_chembl <- function(cont) {
651651
# Helper to flatten a single entity
652652
flatten_entity <- function(entity) {
653653
for (nm in df_names) {
654+
# e.g. activity is sometimes a list sometimes a character string
655+
# only flatten if it is a list to prevent error.
654656
if (nm %in% names(entity)) {
657+
if (inherits(entity[[nm]], "list")) {
655658
entity[[nm]] <- dplyr::bind_rows(entity[[nm]])
659+
}
656660
}
657661
}
658662
for (nm in flat_names) {

0 commit comments

Comments
 (0)