Learn R Programming

galah (version 2.1.1)

arrange.data_request: Order rows using column values

Description

[Experimental]

arrange.data_request() arranges rows of a query on the server side, meaning that the query is constructed in such a way that information will be arranged when the query is processed. This only has an effect when used in combination with count() and group_by(). The benefit of using arrange() within a galah_call() pipe is that it is sometimes beneficial to choose a non-default order for data to be delivered in, particularly if slice_head() is also called.

Usage

# S3 method for data_request
arrange(.data, ...)

# S3 method for metadata_request arrange(.data, ...)

Value

An amended data_request with a completed arrange slot.

Arguments

.data

An object of class data_request

...

A variable to arrange the resulting tibble by. Should be one of the variables also listed in group_by().

Examples

Run this code
if (FALSE) {

# Arrange grouped counts by ascending year
galah_call() |>
  identify("Crinia") |>
  filter(year >= 2020) |>
  group_by(year) |>
  arrange(year) |>
  count() |>
  collect()
  
# Arrange grouped counts by ascending record count
galah_call() |>
  identify("Crinia") |>
  filter(year >= 2020) |>
  group_by(year) |>
  arrange(count) |>
  count() |>
  collect()

# Arrange grouped counts by descending year
galah_call() |>
  identify("Crinia") |>
  filter(year >= 2020) |>
  group_by(year) |>
  arrange(desc(year)) |>
  count() |>
  collect()
}

Run the code above in your browser using DataLab