arrange.data_request {galah}R Documentation

Arrange rows of a query

Description

[Experimental]

arrange.data_request() arranges rows of a query on the server side, meaning that prior to sending a query, the query is constructed in such a way that information will be arranged when the query is processed. Any data that is then returned by the query will have rows already pre-arranged.

The benefit of using arrange() within a galah_call() is that it is faster to process arranging rows on the server side than arranging rows locally on downloaded data, especially if the dataset is large or complex.

arrange() can be used within a galah_call() pipe, but only for queries of type = "occurrences-count". The galah_call() pipe must include count() and finish with collect() (see examples).

Usage

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

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

Arguments

.data

An object of class data_request

...

Either count or index

Examples

## Not run: 

# 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()

## End(Not run)

[Package galah version 2.0.2 Index]