Skip to contents

[Experimental]

This is a simple function to set the limit argument in atlas_counts() using dplyr syntax. As of galah 2.0.0, slice_head() is only supported in queries of type occurrences-count(), or metadata requests. Note also that slice_head() is lazily evaluated; it only affects a query once it is run by compute() or (more likely) collect().

Usage

# S3 method for data_request
slice_head(.data, ..., n, prop, by = NULL)

# S3 method for metadata_request
slice_head(.data, ..., n, prop, by = NULL)

Arguments

.data

An object of class data_request, created using galah_call()

...

currently ignored

n

The number of rows to be returned. If data are grouped (using group_by), this operation will be performed on each group.

prop

currently ignored, but could be added later

by

currently ignored

Examples

if (FALSE) {
# Limit number of rows returned to 3.
# In this case, our query returns the top 3 years with most records.
galah_call() |>
  identify("perameles") |>
  filter(year > 2010) |>
  group_by(year) |>
  count() |>
  slice_head(n = 3) |>
  collect()
}