R/as-tsibble.R
duplicates.Rd
is_duplicated()
: a logical scalar if the data exist duplicated observations.
are_duplicated()
: a logical vector, the same length as the row number of data
.
duplicates()
: identical key-index data entries.
is_duplicated(data, key = NULL, index) are_duplicated(data, key = NULL, index, from_last = FALSE) duplicates(data, key = NULL, index)
data | A data frame for creating a tsibble. |
---|---|
key | Variable(s) that uniquely determine time indices. |
index | A variable to specify the time index variable. |
from_last |
|
harvest <- tibble( year = c(2010, 2011, 2013, 2011, 2012, 2014, 2014), fruit = c(rep(c("kiwi", "cherry"), each = 3), "cherry"), kilo = sample(1:10, size = 7) ) is_duplicated(harvest, key = fruit, index = year)#> [1] TRUEare_duplicated(harvest, key = fruit, index = year)#> [1] FALSE FALSE FALSE FALSE FALSE FALSE TRUEare_duplicated(harvest, key = fruit, index = year, from_last = TRUE)#> [1] FALSE FALSE FALSE FALSE FALSE TRUE FALSEduplicates(harvest, key = fruit, index = year)#> # A tibble: 2 x 3 #> year fruit kilo #> <dbl> <chr> <int> #> 1 2014 cherry 10 #> 2 2014 cherry 4