% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/as-tsibble.R
\name{is_duplicated}
\alias{is_duplicated}
\alias{are_duplicated}
\alias{duplicates}
\title{Test duplicated observations determined by key and index variables}
\usage{
is_duplicated(data, key = NULL, index)

are_duplicated(data, key = NULL, index, from_last = FALSE)

duplicates(data, key = NULL, index)
}
\arguments{
\item{data}{A data frame for creating a tsibble.}

\item{key}{Variable(s) that uniquely determine time indices. \code{NULL} for
empty key, and \code{c()} for multiple variables. It works with tidy selector
(e.g. \code{\link[dplyr:reexports]{dplyr::starts_with()}}).}

\item{index}{A variable to specify the time index variable.}

\item{from_last}{\code{TRUE} does the duplication check from the last of identical
elements.}
}
\description{
\lifecycle{stable}
\itemize{
\item \code{is_duplicated()}: a logical scalar if the data exist duplicated observations.
\item \code{are_duplicated()}: a logical vector, the same length as the row number of \code{data}.
\item \code{duplicates()}: identical key-index data entries.
}
}
\examples{
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)
are_duplicated(harvest, key = fruit, index = year)
are_duplicated(harvest, key = fruit, index = year, from_last = TRUE)
duplicates(harvest, key = fruit, index = year)
}
