funique: A faster unique function

Description Usage Arguments Value Examples

Description

Similar to unique, only optimized for working with date-time columns.

Usage

1

Arguments

x

Input data. If x is not a data frame or date-time object, then it is simply passed to unique

Value

The unique rows/values of x.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
## create example data set
d <- data.frame(
  x = rnorm(1000),
  y = seq.POSIXt(as.POSIXct("2018-01-01"),
    as.POSIXct("2018-12-31"), length.out = 10)
)

## sample to create version with duplicates
dd <- d[c(1:1000, sample(1:1000, 500, replace = TRUE)), ]

## get only unique rows
head(funique(dd))

## check output
identical(unique(dd), funique(dd))

mkearney/funique documentation built on May 25, 2019, 5:01 a.m.