get_pubmed_ids {easyPubMed} | R Documentation |
Simple PubMed Record Search
Description
Query PubMed (Entrez) in a simple way via the PubMed API eSearch function. Calling this function results in posting the query results on the PubMed History Server. This allows later access to the resulting data via the fetch_pubmed_data() function, or other easyPubMed functions.
Usage
get_pubmed_ids(pubmed_query_string, api_key = NULL)
Arguments
pubmed_query_string |
is a string (character vector of length 1) that is used for querying PubMed (standard PubMed synthax, see reference for details). |
api_key |
String (character vector of length 1): user-specific API key to increase the limit of queries per second. You can obtain your key from NCBI. |
Details
This function will use the String provided as argument for querying PubMed via the eSearch function of the PubMed API. The Query Term can include one or multiple words, as well as the standard PubMed operators (AND, OR, NOT) and tags (i.e., [AU], [PDAT], [Affiliation], and so on). ESearch will post the UIDs resulting from the search operation onto the History server so that they can be used directly in a subsequent fetchPubmedData() call.
Value
The function returns a list. The list includes the number of records found on PubMed and the first 20 PubMed IDs (UID) retrieved by the query. The list also includes QueryKey and WebEnv that are required for a subsequent fetch_pubmed_data() call.
Author(s)
Damiano Fantini damiano.fantini@gmail.com
References
https://www.data-pulse.com/dev_site/easypubmed/ https://www.ncbi.nlm.nih.gov/books/NBK3827/#_pubmedhelp_Search_Field_Descriptions_and_
Examples
try({
## Search for scientific articles written by Damiano Fantini
## and print the number of retrieved records to screen.
## Also print the retrieved UIDs to screen.
##
dami_on_pubmed <- get_pubmed_ids("Damiano Fantini[AU]")
print(dami_on_pubmed$Count)
print(unlist(dami_on_pubmed$IdList))
}, silent = TRUE)