Group Results

hal_group(x, ...)

# S3 method for HALQuery
hal_group(x, field, limit = 1, sort = "score", decreasing = FALSE, ...)

Arguments

x

An object of class HALQuery (typically returned by hal_api()).

...

Currently not used.

field

A character string specifying the field to group by.

limit

An integer giving the maximum number of results per group.

sort

A character string specifying the field to be used to sort the results.

decreasing

A logical scalar: should the sort be increasing or decreasing?

Value

An object of class HALQuery.

See also

Other query tools: hal_facet(), hal_filter(), hal_query(), hal_select(), hal_sort()

Author

N. Frerebeau

Examples

if (FALSE) {
library(magrittr)

## Most recent publication by journal
hal_api() %>%
  hal_query("archéologie") %>%
  hal_select("producedDate_tdate") %>%
  hal_filter("ART" %IN% "docType_s") %>%
  hal_sort("producedDate_tdate", decreasing = TRUE) %>%
  hal_group(field = "journalTitle_s", limit = 1,
            sort = "producedDate_tdate", decreasing = TRUE) %>%
  hal_search(limit = 10)
}