vec_slice

0th

Percentile

Get or set observations in a vector

This provides a common interface to extracting and modifying observations for all vector types, regardless of dimensionality. It is an analog to [ that matches vec_size() instead of length().

Keywords
internal
Usage
vec_slice(x, i)

vec_slice(x, i) <- value

Arguments
x

A vector

i

An integer or character vector specifying the positions or names of the observations to get/set.

value

Replacement values.

Aliases
  • vec_slice
  • vec_slice<-
Examples
# NOT RUN {
x <- sample(10)
x
vec_slice(x, 1:3)
vec_slice(x, 2L) <- 100
x

vec_slice(mtcars, 1:3)
# }
Documentation reproduced from package vctrs, version 0.1.0, License: GPL-3

Community examples

Looks like there are no examples yet.