slice()
lets you index rows by their (integer) locations. For objects of
classes data_request
or metadata_request
, only slice_head()
is
currently implemented, and selects the first n
rows.
If .data
has been grouped using
group_by()
, the operation will be
performed on each group, so that (e.g.) slice_head(df, n = 5)
will select
the first five rows in each group.
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
data_request
, created usinggalah_call()
- ...
Currently ignored
- n
The number of rows to be returned. If data are grouped
group_by()
, this operation will be performed on each group.- prop
Currently ignored.
- by
Currently ignored.
Examples
if (FALSE) { # \dontrun{
# 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()
} # }