slice_head.data_request {galah} | R Documentation |
Subset first rows of data_request
Description
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 class 'data_request'
slice_head(.data, ..., n, prop, by = NULL)
## S3 method for class 'metadata_request'
slice_head(.data, ..., n, prop, by = NULL)
Arguments
.data |
An object of class |
... |
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
## Not run:
# 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()
## End(Not run)
[Package galah version 2.0.2 Index]