EVOLUTION-MANAGER
Edit File: na.locf.xts.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: Last Observation Carried Forward</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 na.locf.xts {xts}"><tr><td>na.locf.xts {xts}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2> Last Observation Carried Forward </h2> <h3>Description</h3> <p><span class="pkg">xts</span> method replace ‘NA’ with most recent non-‘NA’ </p> <h3>Usage</h3> <pre> ## S3 method for class 'xts' na.locf(object, na.rm = FALSE, fromLast = FALSE, maxgap=Inf, ...) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>object</code></td> <td> <p>an xts object </p> </td></tr> <tr valign="top"><td><code>na.rm</code></td> <td> <p>logical. Should leading/trailing ‘NA’'s be removed? The default for xts <code>FALSE</code> is different than the default S3 method in the <span class="pkg">zoo</span> package. </p> </td></tr> <tr valign="top"><td><code>fromLast</code></td> <td> <p>logical. Cause observations to be carried backward rather than forward. Default is <code>FALSE</code>. </p> </td></tr> <tr valign="top"><td><code>maxgap</code></td> <td> <p>runs of more than ‘maxgap’ will retain ‘NA’s after the maximum gap specified. See <code>na.locf</code> in the zoo package. </p> </td></tr> <tr valign="top"><td><code>...</code></td> <td> <p>unused </p> </td></tr> </table> <h3>Details</h3> <p>This is the <span class="pkg">xts</span> method for the S3 generic <code>na.locf</code>. The primary difference to note is that after the ‘NA’ fill action is carried out, the default it to leave trailing or leading ‘NA’'s in place. This is different than <span class="pkg">zoo</span> behavior. </p> <h3>Value</h3> <p>See the documentation in zoo. </p> <h3>Author(s)</h3> <p>Jeffrey A. Ryan </p> <h3>References</h3> <p>‘zoo’ </p> <h3>Examples</h3> <pre> x <- xts(1:10, Sys.Date()+1:10) x[c(1,2,5,9,10)] <- NA x na.locf(x) na.locf(x, fromLast=TRUE) na.locf(x, na.rm=TRUE, fromLast=TRUE) </pre> <hr /><div style="text-align: center;">[Package <em>xts</em> version 0.12.2 <a href="00Index.html">Index</a>]</div> </body></html>