[Experimental]

query() creates and returns a query command for a specific database provider.

query(
  ...,
  provider,
  constraint = NULL,
  clipboard = TRUE,
  print = TRUE,
  min_chars = 1,
  delimiter = ",",
  enclosure = "double quote",
  clean_modifiers = TRUE,
  sort = FALSE,
  na_rm = TRUE,
  duplicate_rm = TRUE
)

Arguments

...

One or more character objects with keywords.

provider

A string indicating the database provider name (case insensitive)

constraint

(optional) A character object indicating the type/types of constraint for the query (case insensitive).

clipboard

(optional) A logical value indicating if the function must copy the output to the clipboard.

print

(optional) A logical value indicating if the function must print the output on the console window.

min_chars

(optional) A number indicating the minimal number of characters a keyword must have. Keywords that don't comply to this setting will be transformed to NA (default: 1).

delimiter

(optional) A string with the delimiter used on ... values. Use delimiter = NULL to disable this behavior (default: NULL).

enclosure

(optional) A string indicating the type of enclosure for keywords with special characters (like spaces) (default: "double quote").

clean_modifiers

(optional) A logical value indicating if keywords with modifiers must be transformed to NA (default: TRUE).

sort

(optional) A logical value indicating if the output must be ordered alphabetically (default: FALSE).

na_rm

(optional) A logical value indicating if NA values must be removed from the output (default: TRUE).

duplicate_rm

(optional) A logical value indicating if duplicate values must be removed from the output (default: TRUE).

Value

A string with a query for the provider indicating in provider.

Details

provider argument

query() works with several database providers. At the moment, valid values for the provider argument are:

  • "apa": for APA (American Psychology Association).

  • "ebsco": for EBSCO (Elton Bryson Stephens Company).

  • "embase": for Embase (Excerpta Medica dataBASE).

  • "lilacs": for LILACS (Literatura Latino-americana e do Caribe em Ciencias da Saude).

  • "pubmed": for PubMed.

  • "scielo": for SciELO (Scientific Electronic Library Online).

  • "scopus": for Scopus.

  • "wos": for Web of Science.

constraint argument

The constraint argument must be a character object with the exact name of the constraint (e.g., "Title", "Abstract") that is used in the database provider (case insensitive). Also, the following alias were included to help the user: title, abstract, keyword.

You can see all constraint names available for the query() in refstudio::provider_tags.

Please note that some constraints may not be available for the database you're a searching. Always read the database provider documentation before building your search.

Here are the documentation links of the database providers supported by the query() function.

  • "apa": for APA (American Psychology Association).

  • "ebsco": for EBSCO (Elton Bryson Stephens Company).

  • "embase": for Embase (Excerpta Medica dataBASE)

  • "lilacs": for LILACS (Literatura Latino-americana e do Caribe em Ciencias da Saude).

  • "pubmed": for PubMed.

  • "scielo": for SciELO (Scientific Electronic Library Online).

  • "scopus": for Scopus.

  • "wos": for Web of Science.

OR operators

query() will exclude " OR " operators from character elements in .... This is made to facilitate the keyword set construction.

When using "OR" (without spaces between words) the operator will be interpreted as a keyword.

Creating queries from multiple domain sets

Domains sets are a group of keyword related to a subject. You can Use the boolean operators "AND", "NOT", and "AND NOT" between keywords in the ... argument to get a query with multiple domains. However, it's important to note that a query can only have a fixed set of constraints.

This function was not made to produce a high level of custom programming. Other operators (e.g., SAME, NEAR, W/n, PRE/n) are not supported. To go around this, you can call query() several times and glue the results.

Keyword tidying

query() uses tidy_keyword() to tidy your keywords for output. See tidy_keyword() documentation to learn more about it.

Depending on how you set up the query() arguments, it can generate empty sets (e.g. like when you use min_chars = 100). The function will produce an error in those cases.

See also

Other keyword functions: tidy_keyword()

Examples

## Creating simple queries

query("Lorem", "Ipsum, dolor", "sit", provider = "PubMed",
      constraint = c("title", "abstract"), clipboard = FALSE)
#> lorem[Title/Abstract] OR ipsum[Title/Abstract] OR dolor[Title/Abstract] OR sit[Title/Abstract]
#> (lorem[Title/Abstract]) OR (ipsum[Title/Abstract]) OR
#> (dolor[Title/Abstract]) OR (sit[Title/Abstract]) # Expected

## Creating queries from multiple domains

query("Lorem", "AND", "Ipsum", "NOT", "dolor", provider = "EMBASE",
      constraint = c("title", "abstract"), clipboard = FALSE)
#> (lorem:ti,ab) AND (ipsum:ti,ab) NOT (dolor:ti,ab)
#> (lorem:ti,ab) AND (ipsum:ti,ab) NOT (dolor:ti,ab) # Expected