make.unique.approx: Make a vector unique

Description Usage Arguments Value Examples

View source: R/make.unique.R

Description

Make a vector unique

Usage

1
2
3
make.unique.approx(x, ...)
## Default S3 method:
make.unique.approx(x, quantile = 0:1, ...)

Arguments

x

Vector. Vector of a class which has differences that can be coerced to numeric for which the difference, when added to the first value, returns the second value.

quantile

A number between 0 and 1 (or vector of numbers) such that if it is 0 then the first time value among duplicates is kept as is and the others calculated via linear interpolation or if 1 then the last time value is kept as is and the others calculated via linear interpolation. If an intermediate fraction is used then that quantile is kept as is. If a vector of numbers is specified then they are applied in succession. 0 will not remove duplicates at the end and 1 will not remove trailing duplicates at the beginning but 0:1 or 1:0 will remove both.

...

Further arguments.

Value

The function returns x except among any set of repeated elements the one at the position whose quantile is indicated is left as is and all others are linearly interpolated.

Examples

1
2
xx <- c(10, rep(20, 10), 30)
make.unique.approx(xx)

zooExtra documentation built on May 2, 2019, 5:54 p.m.