idx_slice: Slice idx_tbl by index values

View source: R/slice.R

idx_sliceR Documentation

Slice idx_tbl by index values

Description

Analagous to a left-join of the input against a differently shaped index.

Usage

idx_slice(x, ..., .keep_all = FALSE)

Arguments

x

idx_tbl indexvector

...

index values to slice. If unnamed, refer to idx_cols of x in order. If named they all must be named, and refer to idx_cols by name.

.keep_all

unused, but perhaps to be used in future.

Value

idx_tbl with the same axes as input.

Examples

pop <- idx_tibble(tidyr::population, idx_cols = c("country", "year"))
idx_slice(pop, "Armenia")
idx_slice(pop, year=2000)
pop_grow <- pop / idx_slice(pop, year=2000)

jameelalsalam/indexvctrs documentation built on Oct. 28, 2023, 3:26 a.m.