dplyr (version 0.3.0.1)

slice: Select rows by position.

Description

Select rows by position.

Usage

slice(.data, ...)

slice_(.data, ..., .dots)

Arguments

.data
A tbl. All main verbs are S3 generics and provide methods for tbl_df, tbl_dt and tbl_sql.
...
Integer row values
.dots
Used to work around non-standard evaluation. See vignette("nse") for details.

See Also

Other single.table.verbs: arrange, arrange_; filter, filter_; mutate, mutate_, transmute, transmute_; rename, rename_, select, select_; summarise, summarise_, summarize, summarize_

Examples

Run this code
slice(mtcars, 1L)
slice(mtcars, n())
slice(mtcars, 5:n())

by_cyl <- group_by(mtcars, cyl)
slice(by_cyl, 1:2)

Run the code above in your browser using DataCamp Workspace