search_pubmed: Automatic search on Pubmed database

View source: R/Record_search.R

search_pubmedR Documentation

Automatic search on Pubmed database

Description

Perform an API search using Pubmed E-utilities https://www.ncbi.nlm.nih.gov/books/NBK25501/.

Usage

search_pubmed(
  query,
  year_query = NULL,
  additional_fields = NULL,
  api_key = getOption("baysren.ncbi_api_key"),
  record_limit = numeric()
)

Arguments

query

A boolean query with AND/OR/NOT operators, brackets for term grouping and quotation marks for n-grams.

year_query

A year based filtering query. See clean_date_filter_arg() for more info.

additional_fields

Additional fields to add to the query. Will not be normalized, so it must already follow Pubmed specific syntax.

api_key

Not mandatory but is helpful when performing searches with a large number of results to avoid quota limitations.

record_limit

A limit on the number of records collected.

Details

An API key is not mandatory but may avoid quota limitation for searches that return a large number of results. Large results sets are obtained by iterative querying.

Requires the rentrez package.

Value

A data frame of records.

Examples

## Not run: 
# Initial query to be built on domain knowledge. It accepts OR, AND, NOT
# boolean operators and round brackets to group terms.
query <- '((model OR models OR modeling OR network OR networks) AND
(dissemination OR transmission OR spread OR diffusion) AND (nosocomial OR
hospital OR "long-term-care" OR "long term care" OR "longterm care" OR
"long-term care" OR "healthcare associated") AND (infection OR resistance OR
resistant))'

# Year filter. The framework converts it to the API-specific format seamlessly.
# common logical comparators can be used, i.e. <, <=, >, >=, while dashes
# denotes inclusive date intervals. A single year restricts results to one year
# period.
year_filter <- "2010-2020"

records <- search_pubmed(query, year_filter)

## End(Not run)

bakaburg1/BaySREn documentation built on March 30, 2022, 12:16 a.m.