EVOLUTION-MANAGER
Edit File: uncount.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: "Uncount" a data frame</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 uncount {tidyr}"><tr><td>uncount {tidyr}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>"Uncount" a data frame</h2> <h3>Description</h3> <p>Performs the opposite operation to <code><a href="../../dplyr/html/count.html">dplyr::count()</a></code>, duplicating rows according to a weighting variable (or expression). </p> <h3>Usage</h3> <pre> uncount(data, weights, .remove = TRUE, .id = NULL) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>data</code></td> <td> <p>A data frame, tibble, or grouped tibble.</p> </td></tr> <tr valign="top"><td><code>weights</code></td> <td> <p>A vector of weights. Evaluated in the context of <code>data</code>; supports quasiquotation.</p> </td></tr> <tr valign="top"><td><code>.remove</code></td> <td> <p>If <code>TRUE</code>, and <code>weights</code> is a <code>single</code></p> </td></tr> <tr valign="top"><td><code>.id</code></td> <td> <p>Supply a string to create a new variable which gives a unique identifier for each created row.</p> </td></tr> </table> <h3>Examples</h3> <pre> df <- tibble(x = c("a", "b"), n = c(1, 2)) uncount(df, n) uncount(df, n, .id = "id") # You can also use constants uncount(df, 2) # Or expressions uncount(df, 2 / n) </pre> <hr /><div style="text-align: center;">[Package <em>tidyr</em> version 1.1.2 <a href="00Index.html">Index</a>]</div> </body></html>