ropensci / rentrez

talk with NCBI entrez using R
https://docs.ropensci.org/rentrez
Other
195 stars 38 forks source link

Pull authors’ full names #143

Closed peclayson closed 4 years ago

peclayson commented 4 years ago

Hi,

As far as I can tell, I can only access the full last name and first/middle name initials. Is there a way I can grab at least the full first and last name for each author of a publication?

Thanks! Peter

BPDranka commented 4 years ago

Assuming you have the data as an XML file called XMLData from entrez_fetch

Identify all author nodes

author_nodes <- xml2::xml_find_all(XMLData, ".//Author")

Extract author names for each node

authors <- tibble( first = author_nodes %>% xml2::xml_find_first(".//ForeName") %>% xml2::xml_text(), last = author_nodes %>% xml2::xml_find_first(".//LastName") %>% xml2::xml_text())

Note that this doesn't associate the authors with a specific publication. So if your query returns multiple publications, you'll get all the authors. I haven't gotten quite that far yet...

peclayson commented 4 years ago

Excellent. This works for me.

Thank you! Peter

dwinter commented 4 years ago

Thanks @BPDranka! @peclayson , if you have more questions please file them as issue, I'll try to be quicker to get to them :)