Learn R Programming

StratigrapheR (version 0.0.2)

every_nth: 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

See Also

practical usage of this function for axes: minorAxis

Examples

Run this code
# NOT RUN {
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)

# }

Run the code above in your browser using DataLab