This is an extension to R operators
@ to gain the ability to paste character vectors. This is useful when building queries for the PubMed database (see for example the rentrez package).
Get it from GitHub:
Avoiding the explicit call to
paste makes the code much cleaner:
library(qbuildr) query = "eeg" + "epilepsy" - "temporal" cat(query) #> eeg AND epilepsy NOT temporal
@ operator can be used to add field specification:
query = "eeg" @ "TIAB" + "epilepsy" @ "MeSH" cat(query) #> eeg[TIAB] AND epilepsy[MeSH]
You can build nested queries using the
g function (for "group"). You can add field specification to multiple terms at once by providing a character vector:
query = "pain" @ "TIAB" + g("eeg" | "seeg", "MeSH") - g("mri" | "fmri" | "meg", "TIAB") cat(query) #> pain[TIAB] AND (eeg[MeSH] OR seeg[MeSH]) NOT (mri[TIAB] OR fmri[TIAB] OR meg[TIAB])
Operators still work the usual way with numeric or logical inputs, but they may be slower, so beware:
# With redefined operators system.time(runif(10^7) + runif(10^7)) #> user system elapsed #> 0.988 0.028 1.020 # With original operators detach("package:qbuildr", unload = TRUE) system.time(runif(10^7) + runif(10^7)) #> user system elapsed #> 0.888 0.008 0.896
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.