EVOLUTION-MANAGER
Edit File: distinct_all.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: Select distinct rows by a selection of variables</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 distinct_all {dplyr}"><tr><td>distinct_all {dplyr}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Select distinct rows by a selection of variables</h2> <h3>Description</h3> <a href='https://www.tidyverse.org/lifecycle/#superseded'><img src='figures/lifecycle-superseded.svg' alt='Superseded lifecycle'></a> <p>Scoped verbs (<code style="white-space: pre;">_if</code>, <code style="white-space: pre;">_at</code>, <code style="white-space: pre;">_all</code>) have been superseded by the use of <code><a href="across.html">across()</a></code> in an existing verb. See <code>vignette("colwise")</code> for details. </p> <p>These <a href="scoped.html">scoped</a> variants of <code><a href="distinct.html">distinct()</a></code> extract distinct rows by a selection of variables. Like <code>distinct()</code>, you can modify the variables before ordering with the <code>.funs</code> argument. </p> <h3>Usage</h3> <pre> distinct_all(.tbl, .funs = list(), ..., .keep_all = FALSE) distinct_at(.tbl, .vars, .funs = list(), ..., .keep_all = FALSE) distinct_if(.tbl, .predicate, .funs = list(), ..., .keep_all = FALSE) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>.tbl</code></td> <td> <p>A <code>tbl</code> object.</p> </td></tr> <tr valign="top"><td><code>.funs</code></td> <td> <p>A function <code>fun</code>, a quosure style lambda <code>~ fun(.)</code> or a list of either form.</p> </td></tr> <tr valign="top"><td><code>...</code></td> <td> <p>Additional arguments for the function calls in <code>.funs</code>. These are evaluated only once, with <a href="../../rlang/html/dyn-dots.html">tidy dots</a> support.</p> </td></tr> <tr valign="top"><td><code>.keep_all</code></td> <td> <p>If <code>TRUE</code>, keep all variables in <code>.data</code>. If a combination of <code>...</code> is not distinct, this keeps the first row of values.</p> </td></tr> <tr valign="top"><td><code>.vars</code></td> <td> <p>A list of columns generated by <code><a href="vars.html">vars()</a></code>, a character vector of column names, a numeric vector of column positions, or <code>NULL</code>.</p> </td></tr> <tr valign="top"><td><code>.predicate</code></td> <td> <p>A predicate function to be applied to the columns or a logical vector. The variables for which <code>.predicate</code> is or returns <code>TRUE</code> are selected. This argument is passed to <code><a href="../../rlang/html/as_function.html">rlang::as_function()</a></code> and thus supports quosure-style lambda functions and strings representing function names.</p> </td></tr> </table> <h3>Grouping variables</h3> <p>The grouping variables that are part of the selection are taken into account to determine distinct rows. </p> <h3>Examples</h3> <pre> df <- tibble(x = rep(2:5, each = 2) / 2, y = rep(2:3, each = 4) / 2) distinct_all(df) # -> distinct(df, across()) distinct_at(df, vars(x,y)) # -> distinct(df, across(c(x, y))) distinct_if(df, is.numeric) # -> distinct(df, across(where(is.numeric))) # You can supply a function that will be applied before extracting the distinct values # The variables of the sorted tibble keep their original values. distinct_all(df, round) # -> distinct(df, across(everything(), round)) </pre> <hr /><div style="text-align: center;">[Package <em>dplyr</em> version 1.0.2 <a href="00Index.html">Index</a>]</div> </body></html>