EVOLUTION-MANAGER
Edit File: use_first_valid_of.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: Returns first non-NA value from a set of vectors.</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 use_first_valid_of {janitor}"><tr><td>use_first_valid_of {janitor}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Returns first non-NA value from a set of vectors.</h2> <h3>Description</h3> <p>At each position of the input vectors, iterates through in order and returns the first non-NA value. This is a robust replacement of the common <code>ifelse(!is.na(x), x, ifelse(!is.na(y), y, z))</code>. It's more readable and handles problems like <code>ifelse</code>'s inability to work with dates in this way. </p> <h3>Usage</h3> <pre> use_first_valid_of(..., if_all_NA = NA) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>...</code></td> <td> <p>the input vectors. Order matters: these are searched and prioritized in the order they are supplied.</p> </td></tr> <tr valign="top"><td><code>if_all_NA</code></td> <td> <p>what value should be used when all of the vectors return <code>NA</code> for a certain index? Default is NA.</p> </td></tr> </table> <h3>Value</h3> <p>Returns a single vector with the selected values. </p> <h3>Warning</h3> <p>Deprecated, do not use in new code. Use <code>dplyr::coalesce()</code> instead. </p> <h3>See Also</h3> <p>janitor_deprecated </p> <hr /><div style="text-align: center;">[Package <em>janitor</em> version 2.1.0 <a href="00Index.html">Index</a>]</div> </body></html>