replace_seq {ggblanket}R Documentation

Replace a sequence of elements in a vector

Description

Keep every nth element in a vector, and replace the rest with a value such as "".

Usage

replace_seq(x, ..., keep_nth = 2, offset = 0, replacement = "")

Arguments

x

A vector.

...

If numeric, other arguments passed to the scales::comma function.

keep_nth

The increment of elements to keep as is. Defaults to 2.

offset

An offset to start at the intended offset. Defaults to 0. Possible replaces are -1 to (keep_nth - 2)

replacement

The replacement value to replace non-kept elements with. Defaults to "".

Value

A vector.

Examples

replace_seq(seq(1000, 7000, 1000))
replace_seq(seq(1000, 7000, 1000), offset = -1)
replace_seq(seq(1000, 7000, 1000), keep_nth = 3)
replace_seq(LETTERS[1:12])


[Package ggblanket version 8.0.0 Index]