multiplyr (version 0.1.1)

slice: Select rows by position

Description

This function is used to filter out everything except a specified subset of the data. The each parameter is used to change slice's behaviour to filter out all except a specified subset within each group or, if no grouping, within each node.

Usage

slice(.self, rows = NULL, start = NULL, end = NULL, each = FALSE, auto_compact = NULL)

Arguments

.self
Data frame
rows
Rows to select
start
Start of range of rows
end
End of range of rows
each
Apply slice to each cluster/group
auto_compact
Compact data

Value

Data frame

See Also

Other row manipulations: arrange, distinct, filter, group_by

Examples

Run this code

dat <- Multiplyr (x=1:100, G=rep(c("A", "B", "C", "D"), each=25))
dat %>% group_by (G)
dat %>% slice (1:10, each=TRUE)
dat %>% slice (1:10)
dat %>% shutdown()

Run the code above in your browser using DataCamp Workspace