These are methods for the base generics head()
and tail()
. They
are not translated.
Usage
# S3 method for dtplyr_step
head(x, n = 6L, ...)
# S3 method for dtplyr_step
tail(x, n = 6L, ...)
Arguments
- x
A lazy_dt()
- n
Number of rows to select. Can use a negative number to instead
drop rows from the other end.
- ...
Passed on to head()
/tail()
.
Examples
library(dplyr, warn.conflicts = FALSE)
dt <- lazy_dt(data.frame(x = 1:10))
# first three rows
head(dt, 3)
#> Source: local data table [3 x 1]
#> Call: head(`_DT17`, n = 3)
#>
#> x
#> <int>
#> 1 1
#> 2 2
#> 3 3
#>
#> # Use as.data.table()/as.data.frame()/as_tibble() to access results
# last three rows
tail(dt, 3)
#> Source: local data table [3 x 1]
#> Call: tail(`_DT17`, n = 3)
#>
#> x
#> <int>
#> 1 8
#> 2 9
#> 3 10
#>
#> # Use as.data.table()/as.data.frame()/as_tibble() to access results
# drop first three rows
tail(dt, -3)
#> Source: local data table [7 x 1]
#> Call: tail(`_DT17`, n = -3)
#>
#> x
#> <int>
#> 1 4
#> 2 5
#> 3 6
#> 4 7
#> 5 8
#> 6 9
#> # … with 1 more row
#>
#> # Use as.data.table()/as.data.frame()/as_tibble() to access results