USEPA / ccdR

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/
https://github.com/USEPA/ctxR
GNU General Public License v3.0
2 stars 0 forks source link

Bioactivity API "get_all_assays" some columns in difficult format #7

Closed cthunes closed 6 months ago

cthunes commented 6 months ago

The columns "gene", "assayList", and "citations" are being returned in a "nested" data table form. I think these would be best to have in a list for each row because the nested data table form is too wide.

Viewing the table on RStudio with these changes would appear like the following: image

Here's a snippet of how I handled this change after receiving the return from "get_all_assays"

res_dt[c("gene", "assayList", "citations")] <- lapply(res_dt[c("gene", "assayList", "citations")], 
                                                      function(df) do.call("mapply", c(list, df,
                                                                                       SIMPLIFY = FALSE, 
                                                                                       USE.NAMES=FALSE)))
rachmaninoffpk commented 6 months ago

This looks like a good workaround to the current nested return form.