slice_head.duckplyr_df {duckplyr} | R Documentation |
Subset rows using their positions
Description
This is a method for the dplyr::slice_head()
generic.
slice_head()
selects the first rows.
Usage
## S3 method for class 'duckplyr_df'
slice_head(.data, ..., n, prop, by = NULL)
Arguments
.data |
A data frame, data frame extension (e.g. a tibble), or a lazy data frame (e.g. from dbplyr or dtplyr). See Methods, below, for more details. |
... |
For Provide either positive values to keep, or negative values to drop. The values provided must be either all positive or all negative. Indices beyond the number of rows in the input are silently ignored. For |
n , prop |
Provide either A negative value of |
by |
< |
Fallbacks
There is no DuckDB translation in slice_head.duckplyr_df()
if
by
orprop
is provided,with a negative
n
.
These features fall back to dplyr::slice_head()
, see vignette("fallback")
for details.
See Also
Examples
library(duckplyr)
df <- data.frame(x = 1:3)
df <- slice_head(df, n = 2)
df