Predecessor to ctxR. Utilities for Interacting with the CTX APIs in R without prior API knowledge. All data is also available on the CompTox Chemical Dashboard (CCD) https://comptox.epa.gov/dashboard/
I'm assuming the preference is to return tables. The two that return as lists currently likely contain non-length 1 (NULL or a length > 1) list items, which I assume is why it wasn't automatically converted to a table. The functions may need to handle the fixes with something like the following:
for (i in 1:length(res)) {
if (is.null(res[[i]])) res[[i]] <- NA # set any NULLs to NA
if (length(res[[i]]) > 1) {
res[[i]] <- list(res[[i]]) # put lengths > 1 into a list to be just length 1, will unnest after
}
}
res_dt <- tibble::as_tibble_row(res)
I'm assuming the preference is to return tables. The two that return as lists currently likely contain non-length 1 (NULL or a length > 1) list items, which I assume is why it wasn't automatically converted to a table. The functions may need to handle the fixes with something like the following: