See the Elastic documentation for the syntax and features: https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html

advanced_search(
  ...,
  json = NULL,
  format = c("short", "long"),
  from = 1,
  size = 10
)

Arguments

...

Search terms. For named terms, the name specifies the field to search for. For unnamed ones, the term is taken as is. The individual terms are combined with the AND operator.

json

A character string that contains the query to send to Elastic. If this is not NULL, then you cannot specify any search terms in ....

format

Default formatting of the results. short only outputs the name and title of the packages, long also prints the author, last version, full description and URLs. Note that this only affects the default printing, and you can still inspect the full results, even if you specify short here.

from

Where to start listing the results, for pagination.

size

The number of results to list.

Value

Search hits.

Examples

# All orphaned packages
advanced_search(Maintainer = "ORPHANED")
#> - "advanced search" ----------------------------- 4 packages in 0.004 seconds -
#>   #     package   version   by         @ title                                 
#>  1  100 udunits2  0.13.2.1  ORPHANED  3y Udunits-2 Bindings for R              
#>  2  100 taxize    0.9.100.1 ORPHANED  5M Taxonomic Information from Around t...
#>  3  100 shipunov  1.17.1    ORPHANED  2y Miscellaneous Functions from Alexey...
#>  4  100 fastclime 1.4.1.1   ORPHANED  2y A Fast Solver for Parameterized LP ...

# Packages with both Hester and Wickham as authors
advanced_search(Author = "Hester", Author = "Wickham")
#> - "advanced search" ---------------------------- 23 packages in 0.026 seconds -
#>   #     package     version by                  @ title                        
#>   1 100 mockery     0.4.4   Hadley Wickham     1y Mocking Library for R        
#>   2  94 pkgbuild    1.4.5   Gábor Csárdi       2M Find Tools Needed to Build...
#>   3  85 memoise     2.0.1   Winston Chang      3y 'Memoisation' of Functions   
#>   4  79 sessioninfo 1.2.2   Gábor Csárdi       3y R Session Information        
#>   5  79 devtools    2.4.5   Jennifer Bryan     2y Tools to Make Developing R...
#>   6  75 xml2        1.3.6   Hadley Wickham     1y Parse XML                    
#>   7  75 odbc        1.5.0   Hadley Wickham     7M Connect to ODBC Compatible...
#>   8  72 meltr       1.0.2   Duncan Garmonsway  1y Read Non-Rectangular Text ...
#>   9  69 remotes     2.5.0   Gábor Csárdi      10M R Package Installation fro...
#>  10  67 fs          1.6.5   Gábor Csárdi       2M Cross-Platform File System...
advanced_search("Author: Hester AND Author: Wickham")
#> - "advanced search" ---------------------------- 23 packages in 0.003 seconds -
#>   #     package     version by                  @ title                        
#>   1 100 mockery     0.4.4   Hadley Wickham     1y Mocking Library for R        
#>   2  94 pkgbuild    1.4.5   Gábor Csárdi       2M Find Tools Needed to Build...
#>   3  85 memoise     2.0.1   Winston Chang      3y 'Memoisation' of Functions   
#>   4  79 sessioninfo 1.2.2   Gábor Csárdi       3y R Session Information        
#>   5  79 devtools    2.4.5   Jennifer Bryan     2y Tools to Make Developing R...
#>   6  75 xml2        1.3.6   Hadley Wickham     1y Parse XML                    
#>   7  75 odbc        1.5.0   Hadley Wickham     7M Connect to ODBC Compatible...
#>   8  72 meltr       1.0.2   Duncan Garmonsway  1y Read Non-Rectangular Text ...
#>   9  69 remotes     2.5.0   Gábor Csárdi      10M R Package Installation fro...
#>  10  67 fs          1.6.5   Gábor Csárdi       2M Cross-Platform File System...

# Packages with Hester but not Wickham as author
advanced_search(Author = "Hester AND NOT Wickham")
#> - "advanced search" ---------------------------- 27 packages in 0.027 seconds -
#>   #     package        version by                        @ title               
#>   1 100 knitrBootstrap 1.0.3   Jim Hester               1y 'knitr' Bootstrap...
#>   2  92 types          1.0.0   Jim Hester               8y Type Annotations    
#>   3  82 primerTree     1.0.6   Matt Cannon              3y Visually Assessin...
#>   4  73 rex            1.2.1   Kevin Ushey              3y Friendly Regular ...
#>   5  69 gmailr         2.0.0   Jennifer Bryan           2y Access the 'Gmail...
#>   6  67 spelling       2.3.1   Jeroen Ooms              3M Tools for Spell C...
#>   7  65 roger          1.5.1   Vincent Goulet           1y Automated Grading...
#>   8  61 available      1.1.0   Gábor Csárdi             3y Check if the Titl...
#>   9  60 bench          1.1.3   Davis Vaughan            2y High Precision Ti...
#>  10  60 tidycode       0.1.1   Lucy D'Agostino McGowan  5y Analyze Lines of ...

# Packages with Hester as an Author, and Wickham in any field
advanced_search(Author = "Hester", "Wickham")
#> - "advanced search" ---------------------------- 23 packages in 0.009 seconds -
#>   #     package     version by                  @ title                        
#>   1 100 mockery     0.4.4   Hadley Wickham     1y Mocking Library for R        
#>   2  87 xml2        1.3.6   Hadley Wickham     1y Parse XML                    
#>   3  87 odbc        1.5.0   Hadley Wickham     7M Connect to ODBC Compatible...
#>   4  87 pkgbuild    1.4.5   Gábor Csárdi       2M Find Tools Needed to Build...
#>   5  77 memoise     2.0.1   Winston Chang      3y 'Memoisation' of Functions   
#>   6  75 devtools    2.4.5   Jennifer Bryan     2y Tools to Make Developing R...
#>   7  74 S7          0.2.0   Hadley Wickham     2M An Object Oriented System ...
#>   8  71 sessioninfo 1.2.2   Gábor Csárdi       3y R Session Information        
#>   9  66 remotes     2.5.0   Gábor Csárdi      10M R Package Installation fro...
#>  10  65 meltr       1.0.2   Duncan Garmonsway  1y Read Non-Rectangular Text ...

# Packages with Hester as an Author and Wickham nowhere in the metadata
advanced_search(Author = "Hester", "NOT Wickham")
#> - "advanced search" ---------------------------- 27 packages in 0.013 seconds -
#>   #     package        version by                        @ title               
#>   1 100 knitrBootstrap 1.0.3   Jim Hester               1y 'knitr' Bootstrap...
#>   2  92 types          1.0.0   Jim Hester               8y Type Annotations    
#>   3  82 primerTree     1.0.6   Matt Cannon              3y Visually Assessin...
#>   4  73 rex            1.2.1   Kevin Ushey              3y Friendly Regular ...
#>   5  69 gmailr         2.0.0   Jennifer Bryan           2y Access the 'Gmail...
#>   6  67 spelling       2.3.1   Jeroen Ooms              3M Tools for Spell C...
#>   7  65 roger          1.5.1   Vincent Goulet           1y Automated Grading...
#>   8  61 available      1.1.0   Gábor Csárdi             3y Check if the Titl...
#>   9  60 bench          1.1.3   Davis Vaughan            2y High Precision Ti...
#>  10  60 tidycode       0.1.1   Lucy D'Agostino McGowan  5y Analyze Lines of ...

# Packages for permutation tests and permissive licenses
advanced_search("permutation test AND NOT License: GPL OR GNU")
#> - "advanced search" --------------------------- 561 packages in 0.047 seconds -
#>   #     package       version by                         @ title               
#>   1 100 phd           0.2     Jesse Hemerik             3y Permutation Testi...
#>   2  94 confSAM       0.2     Jesse Hemerik             7y Estimates and Bou...
#>   3  92 permutes      2.8     Cesko C. Voeten           1y Permutation Tests...
#>   4  78 BurStMisc     1.1     Pat Burns                 8y Burns Statistics ...
#>   5  75 resample      0.6     Tim Hesterberg            3y Resampling Functions
#>   6  75 IMEC          0.2.0   Maximilian Maier          4y Ising Model of Ex...
#>   7  74 USP           0.1.2   Thomas B. Berrett         4y U-Statistic Permu...
#>   8  74 packager      1.15.2  Andreas Dominik Cullmann  1y Create, Build and...
#>   9  69 fdrci         2.4     Joshua Millstein          2y Permutation-Based...
#>  10  68 MultSurvTests 0.2     Lukas Arnroth             4y Permutation Tests...

# Packages that have a certain field
advanced_search("_exists_" = "URL")
#> - "advanced search" ------------------------- 10000 packages in 0.034 seconds -
#>   #     package   version by                   @ title                         
#>   1 100 ale       0.3.0   Chitu Okoli        11M Interpretable Machine Learn...
#>   2 100 dlr       1.0.1   Jon Harmon          3y Download and Cache Files Sa...
#>   3 100 SEAHORS   1.8.0   Sebastien Plutniak  2y Spatial Exploration of ArcH...
#>   4 100 pTITAN2   1.0.2   Peter DeWitt        3y Permutations of Treatment L...
#>   5 100 tidydice  1.0.0   Roland Krasser      2y Simulates Dice Rolls and Co...
#>   6 100 BayesfMRI 0.3.11  Amanda Mejia        1y Spatial Bayesian Methods fo...
#>   7 100 zstdlite  0.2.7   Mike Cheng         10M Fast Compression and Serial...
#>   8 100 ingres    1.0.0   Pedro Victori       2y Infer Gene Probabilistic Bo...
#>   9 100 pkgstats  0.1.1   Mark Padgham        3y Metrics of R Packages         
#>  10 100 irtplay   1.6.5   Hwanggyu Lim        2y Unidimensional Item Respons...

# Packages that do not have a certain field:
advanced_search("NOT _exists_: URL")
#> - "advanced search" -------------------------- 10000 packages in 0.05 seconds -
#>   #     package    version by                            @ title               
#>   1 NaN coconots   1.1.3   Manuel Huth                  1y Convolution-Close...
#>   2 NaN ANOVAShiny 0.1.0   Kartikeya Bolar              6y Interactive Docum...
#>   3 NaN causaldrf  0.4.2   Douglas Galagate             2y Estimating Causal...
#>   4 NaN lwqs       0.5.0   Paul Curtin                  4y Lagged Weighted Q...
#>   5 NaN twangRDC   1.0     Matthew Cefalu               4y Gradient Boosting...
#>   6 NaN SenTinMixt 1.0.0   Salvatore D. Tomarchio       3y Parsimonious Mixt...
#>   7 NaN simml      0.3.0   Hyung Park                   4y Single-Index Mode...
#>   8 NaN BLSM       0.1.0   Alberto Donizetti            7y Bayesian Latent S...
#>   9 NaN HDMFA      0.1.1   Ran Zhao                     1y High-Dimensional ...
#>  10 NaN gnomonicM  1.0.1   Josymar Torrejon-Magallanes  4y Estimate Natural ...

# The same but as JSON query
query <- '{
"query": {
  "bool": {
    "must_not": {
      "exists": {
        "field": "URL"
      }
    }
  }
}
}'
advanced_search(json = query)
#> - "advanced search" ------------------------- 10000 packages in 0.014 seconds -
#>   #     package    version by                            @ title               
#>   1 NaN coconots   1.1.3   Manuel Huth                  1y Convolution-Close...
#>   2 NaN ANOVAShiny 0.1.0   Kartikeya Bolar              6y Interactive Docum...
#>   3 NaN causaldrf  0.4.2   Douglas Galagate             2y Estimating Causal...
#>   4 NaN lwqs       0.5.0   Paul Curtin                  4y Lagged Weighted Q...
#>   5 NaN twangRDC   1.0     Matthew Cefalu               4y Gradient Boosting...
#>   6 NaN SenTinMixt 1.0.0   Salvatore D. Tomarchio       3y Parsimonious Mixt...
#>   7 NaN simml      0.3.0   Hyung Park                   4y Single-Index Mode...
#>   8 NaN BLSM       0.1.0   Alberto Donizetti            7y Bayesian Latent S...
#>   9 NaN HDMFA      0.1.1   Ran Zhao                     1y High-Dimensional ...
#>  10 NaN gnomonicM  1.0.1   Josymar Torrejon-Magallanes  4y Estimate Natural ...

# Regular expressions
advanced_search(Author = "/Joh?nathan/")
#> - "advanced search" ----------------------------- 0 packages in 0.058 seconds -

# Fuzzy search
advanced_search(Author = "Johnathan~1")
#> - "advanced search" --------------------------- 276 packages in 0.067 seconds -
#>   #     package    version by                                        @ title   
#>   1 100 lda        1.5.2   Santiago Olivella                        9M Colla...
#>   2 100 bootImpute 1.2.1   Jonathan Bartlett                        2y Boots...
#>   3 100 mlmi       1.1.2   Jonathan Bartlett                        2y Maxim...
#>   4 100 chords     0.95.4  Jonathan Rosenblatt                      8y Estim...
#>   5 100 rSHAPE     0.3.2   Jonathan Dench                           5y Simul...
#>   6 100 handyplots 1.1.3   Jonathan Schwartz                        6y Handy...
#>   7 100 UnitCircle 0.1.3   Jonathan Berrisch                        6y Check...
#>   8  96 ClamR      2.1.3   Jonathan M. Lees<jonathan.lees@unc.edu>  1y Time ...
#>   9  96 RSeed      0.1.60  Claus Jonathan Fritzemeier               8y Boren...
#>  10  92 ggedit     0.4.1   Jonathan Sidi                           10M Inter...