norpt: A function to take out repeated observations in a vector of...

View source: R/sorter.R

norptR Documentation

A function to take out repeated observations in a vector of data for sorting purposes.

Description

This function removes repeated observations from a vector, filling the "gaps" with NA values to maintain the original vector length. It's useful for preparing data for sorting where unique values are necessary, and the overall structure of the dataset (i.e., its length) should be preserved.

Usage

norpt(alist = c(1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5))

Arguments

alist

A numeric vector from which repeated values are to be removed.

Value

A vector excluding repeated values with trailing NA's to fill the vector to its original length.

Author(s)

Stephen J. Tueller

References

Tueller, S. J., Van Dorn, R. A., & Bobashev, G. V. (2016). Visualization of categorical longitudinal and times series data (Report No. MR-0033-1602). Research Triangle Park, NC: RTI Press. http://www.rti.org/publication/visualization-categorical-longitudinal-and-times-series-data

See Also

makePatterns for usage of the output from norpt as input.

Examples

alist <- c(1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5)
norpt(alist)


stueller/longCatEDA documentation built on March 9, 2024, 4:08 a.m.