% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/operations.R
\name{\%in\%,dbDenseMatrix,ANY-method}
\alias{\%in\%,dbDenseMatrix,ANY-method}
\alias{\%in\%,ANY,dbDenseMatrix-method}
\alias{\%in\%,dbSparseMatrix,ANY-method}
\title{Value Matching}
\usage{
\S4method{\%in\%}{dbDenseMatrix,ANY}(x, table)

\S4method{\%in\%}{ANY,dbDenseMatrix}(x, table)

\S4method{\%in\%}{dbSparseMatrix,ANY}(x, table)
}
\arguments{
\item{x}{A dbMatrix object or any other object}

\item{table}{Any object or a dbMatrix object}
}
\value{
A logical vector of the same length as \code{x}, indicating which elements of \code{x} are in \code{table}.
}
\description{
Implements the \code{\%in\%} operator for dbMatrix objects. This operator checks if
elements from the left operand are contained in the right operand, returning
a logical vector.
}
\details{
This is a method for the standard \code{\%in\%} operator for dbMatrix objects.
It follows R's standard behavior for the \code{\%in\%} operator:
\itemize{
\item When \code{x} is a dbDenseMatrix, it returns a logical vector with the same length as the
total number of elements in the matrix.
\item When \code{table} is a dbDenseMatrix, it allows checking if elements in \code{x} are in the matrix.
\item For dbSparseMatrix objects, it throws an error to match the behavior of dgCMatrix.
}
}
\examples{
con <- DBI::dbConnect(duckdb::duckdb(), ":memory:")
mat <- matrix(1:9, nrow = 3, ncol = 3)
dbmat <- dbMatrix(
  value = mat,
  con = con,
  name = "example_matrix",
  class = "dbDenseMatrix",
  overwrite = TRUE
)

dbmat \%in\% c(1, 3, 5, 7, 9)

c(1, 3, 5, 7, 9) \%in\% dbmat
DBI::dbDisconnect(con, shutdown = TRUE)
}
\concept{transform}
