Open johnomics opened 3 years ago
It doesn't look like the code in this repo will be updated any time soon, so you'll have to institute a workaround.
rentrez
does output entrez_link()
results with different classes if it is a single result or list. I handled this situation when extracting PubMed IDs by defining s3 methods for the two different outputs elink
(single result) and elink_list
(list of results). See https://github.com/allenbaron/DO.utils/blob/632093c8ea37ac46a18ae559a4a0ea59395edbd4/R/extract.R#L77-L188.
I created a fork of rentrez
to fix another bug (see PR #174). You're welcome to submit a pull request there. I'd be happy to merge it.
Thanks for developing rentrez, it is excellent.
The man page for
entrez_link
says whenby_id = TRUE
, a list ofelink
objects will be returned, one for each ID inid
. This works for the example shown in the tutorial:But this is what happens with only a single ID:
The link is returned, but as a single link, not as a list with one link. And an unnecessary warning is produced - the link's data is returned with no problems.
Please could this be returned as a list containing a single link, instead of just the single link, and the warning removed? I realise this is a slightly odd request - why use by_id with only one ID? It's because I'm running upstream queries that return different (unknown) numbers of IDs, sometimes returning only a single ID, and I want the output to always be a list so I can process it consistently. Otherwise, I need to check every return value of entrez_link to see whether it returned a single value or a list, and I need to suppress the warning, as the output is fine.