powered by
Keep every nth element in a vector, and replace the rest with a value such as "".
""
replace_seq(x, ..., keep_nth = 2, offset = 0, replacement = "")
A vector.
If numeric, other arguments passed to the scales::comma function.
scales::comma
The increment of elements to keep as is. Defaults to 2.
2
An offset to start at the intended offset. Defaults to 0. Possible replaces are -1 to (keep_nth - 2)
0
-1
keep_nth - 2
The replacement value to replace non-kept elements with. Defaults to "".
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])
Run the code above in your browser using DataLab