% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/ranges-join-mcols.R
\name{join_mcols_inner}
\alias{join_mcols_inner}
\alias{join_mcols_left}
\title{Join data by metadata columns}
\usage{
join_mcols_inner(x, y, by = NULL, ...)

join_mcols_left(x, y, by = NULL, ...)
}
\arguments{
\item{x}{Object representing ranges, with metadata
columns containing variables for matching}

\item{y}{A table of data, DataFrame, data.frame or tibble}

\item{by}{Specifications of the columns used for merging.
Passed to \code{S4Vectors::merge()}}

\item{...}{Additional arguments passed to \code{S4Vectors::merge()}}
}
\value{
Object representing ranges, with new metadata columns
}
\description{
These functions enable joins based on metadata
of \code{x} and data in \code{y}, utilizing
\code{\link[S4Vectors:Vector-merge]{S4Vectors::merge()}}.
}
\details{
The function \code{\link[=join_mcols_inner]{join_mcols_inner()}} returns ranges in
\code{x} only when a match is found in the columns specified with
\code{by} in the table \code{y}.

The function \code{\link[=join_mcols_left]{join_mcols_left()}} returns all ranges in \code{x}
regardless of a match in \code{y}, with duplications possible
from multiple matches.
}
\examples{

x <- as_granges(data.frame(
  seqnames = "chr1", start = 1:5, width=10,
  id=c(1:4,4), foo=letters[1:5]
))
y <- DataFrame(id=c(1:2,2,4), bar=letters[6:9])

# metadata joins:
join_mcols_inner(x, y, by="id")
join_mcols_left(x, y, by="id")

}
