Skip to content

Pubmed (XML) data to data.frame

1 message · Marc Marí Dell'Olmo

#
Dear all,

I would like to obtain a data.frame with some data selected from
pubmed information. For example, I would like to do an specific search
and obtain a data.frame with the title of each article and the
publication type.

Example of syntax:
Mensajes de aviso perdidos
NCBI requests that you provide an email address with each query to their API.
 Set the global option 'reutils.email' to your address to make this
message go away.
Mensajes de aviso perdidos
NCBI requests that you provide an email address with each query to their API.
 Set the global option 'reutils.email' to your address to make this
message go away.
BUT HERE I HAVE THE PROBLEM

Each article (PMID) can have more than one type of publication.
With this syntax I can select the first type of publication
[1] 181
With this syntax I can select the second type of publication.
[1] 152
But I would like to obtain a vector of length 181 (as ptype1) with
NA's when there is no information of publication list

Therefore I cannot obtain a data.frame because I don't obtain a NA
when there is no data in ptype2
Error en data.frame(journal = journal, ptype1 = ptype1, ptype2 = ptype2) :
  arguments imply differing number of rows: 181, 152

How can I do this data.frame???

Best Regards,

Marc