EveryNth: Add empty values into a vector

View source: R/EveryNth.R

EveryNthR Documentation

Add empty values into a vector

Description

This function is particularly useful function for placing tick marks between labels in ggplot objects

Usage

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

Arguments

x

vector

nth

specify which elements are removed, i.e., every nth

empty

logical specifying where elements are dropped or replaced

inverse

logical specifying whether to drop every nth (FALSE; default) or save every nth (TRUE)

Details

I found this function on Stack Overflow while looking for a way to add tick marks to ggplot plots. URL provided in references. Post with function code was created by user *adamdsmith*.

Value

Vector with every nth value removed or made into an empty string

References

https://stackoverflow.com/questions/34533472/insert-blanks-into-a-vector-for-e-g-minor-tick-labels-in-r


leftygray/LeftysRpkg documentation built on Feb. 11, 2024, 5:13 p.m.