every_nth: Suppresses every n th element of a vector

View source: R/every_nth.R

every_nthR Documentation

Suppresses every n th element of a vector

Description

Suppresses every n th element of a vector

Usage

every_nth(x, nth, empty = TRUE, inverse = FALSE)

Arguments

x

a vector (numbers, integers, characters, you name it)

nth

the multiple of position where the elements will be suppressed (nth + 1 actually) or kept (if inverse = T)

empty

whether the suppressed element should be replaced by ""

inverse

opposite reaction: n th elements only will be kept

Value

a vector with the remaining values

Author(s)

Adam D. Smith

See Also

practical usage of this function for axes: minorAxis

Examples

numvec <- 0:20

every_nth(numvec, 3)

every_nth(numvec, 3, empty = FALSE)

every_nth(numvec, 3, inverse = TRUE)

every_nth(numvec, 3, empty = FALSE, inverse = TRUE)


StratigrapheR documentation built on July 9, 2023, 6:02 p.m.