EVOLUTION-MANAGER
Edit File: nest_join.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Nest join</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for nest_join {dplyr}"><tr><td>nest_join {dplyr}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Nest join</h2> <h3>Description</h3> <p><code>nest_join()</code> returns all rows and columns in <code>x</code> with a new nested-df column that contains all matches from <code>y</code>. When there is no match, the list column is a 0-row tibble. </p> <h3>Usage</h3> <pre> nest_join(x, y, by = NULL, copy = FALSE, keep = FALSE, name = NULL, ...) ## S3 method for class 'data.frame' nest_join(x, y, by = NULL, copy = FALSE, keep = FALSE, name = NULL, ...) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>x, y</code></td> <td> <p>A pair of data frames, data frame extensions (e.g. a tibble), or lazy data frames (e.g. from dbplyr or dtplyr). See <em>Methods</em>, below, for more details.</p> </td></tr> <tr valign="top"><td><code>by</code></td> <td> <p>A character vector of variables to join by. </p> <p>If <code>NULL</code>, the default, <code style="white-space: pre;">*_join()</code> will perform a natural join, using all variables in common across <code>x</code> and <code>y</code>. A message lists the variables so that you can check they're correct; suppress the message by supplying <code>by</code> explicitly. </p> <p>To join by different variables on <code>x</code> and <code>y</code>, use a named vector. For example, <code>by = c("a" = "b")</code> will match <code>x$a</code> to <code>y$b</code>. </p> <p>To join by multiple variables, use a vector with length > 1. For example, <code>by = c("a", "b")</code> will match <code>x$a</code> to <code>y$a</code> and <code>x$b</code> to <code>y$b</code>. Use a named vector to match different variables in <code>x</code> and <code>y</code>. For example, <code>by = c("a" = "b", "c" = "d")</code> will match <code>x$a</code> to <code>y$b</code> and <code>x$c</code> to <code>y$d</code>. </p> <p>To perform a cross-join, generating all combinations of <code>x</code> and <code>y</code>, use <code>by = character()</code>.</p> </td></tr> <tr valign="top"><td><code>copy</code></td> <td> <p>If <code>x</code> and <code>y</code> are not from the same data source, and <code>copy</code> is <code>TRUE</code>, then <code>y</code> will be copied into the same src as <code>x</code>. This allows you to join tables across srcs, but it is a potentially expensive operation so you must opt into it.</p> </td></tr> <tr valign="top"><td><code>keep</code></td> <td> <p>Should the join keys from both <code>x</code> and <code>y</code> be preserved in the output? Only applies to <code>nest_join()</code>, <code>left_join()</code>, <code>right_join()</code>, and <code>full_join()</code>.</p> </td></tr> <tr valign="top"><td><code>name</code></td> <td> <p>The name of the list column nesting joins create. If <code>NULL</code> the name of <code>y</code> is used.</p> </td></tr> <tr valign="top"><td><code>...</code></td> <td> <p>Other parameters passed onto methods.</p> </td></tr> </table> <h3>Details</h3> <p>In some sense, a <code>nest_join()</code> is the most fundamental join since you can recreate the other joins from it: </p> <ul> <li> <p><code>inner_join()</code> is a <code>nest_join()</code> plus <code><a href="../../tidyr/html/nest.html">tidyr::unnest()</a></code> </p> </li> <li> <p><code>left_join()</code> <code>nest_join()</code> plus <code>unnest(.drop = FALSE)</code>. </p> </li> <li> <p><code>semi_join()</code> is a <code>nest_join()</code> plus a <code>filter()</code> where you check that every element of data has at least one row, </p> </li> <li> <p><code>anti_join()</code> is a <code>nest_join()</code> plus a <code>filter()</code> where you check every element has zero rows. </p> </li></ul> <h3>Methods</h3> <p>This function is a <strong>generic</strong>, which means that packages can provide implementations (methods) for other classes. See the documentation of individual methods for extra arguments and differences in behaviour. </p> <p>The following methods are currently available in loaded packages: no methods found. </p> <h3>See Also</h3> <p>Other joins: <code><a href="filter-joins.html">filter-joins</a></code>, <code><a href="mutate-joins.html">mutate-joins</a></code> </p> <h3>Examples</h3> <pre> band_members %>% nest_join(band_instruments) </pre> <hr /><div style="text-align: center;">[Package <em>dplyr</em> version 1.0.2 <a href="00Index.html">Index</a>]</div> </body></html>