Sort Results

hal_sort(x, field, decreasing = FALSE, ...)

hal_sort(x, field, decreasing = FALSE, ...)

Arguments

x

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

field

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

decreasing

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

...

Currently not used.

Value

An object of class HALQuery.

See also

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

Author

N. Frerebeau

Examples

library(magrittr)

## Select fields
hal1 <- hal_api() %>% hal_sort("docid")
hal1$sort
#> [1] "docid asc"

## Update query
hal2 <- hal_sort(hal1, "producedDate_tdate", decreasing = TRUE)
hal2$sort
#> [1] "producedDate_tdate desc"