EVOLUTION-MANAGER
Edit File: update.formula.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: Model Updating</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 update.formula {stats}"><tr><td>update.formula {stats}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Model Updating</h2> <h3>Description</h3> <p><code>update.formula</code> is used to update model formulae. This typically involves adding or dropping terms, but updates can be more general. </p> <h3>Usage</h3> <pre> ## S3 method for class 'formula' update(old, new, ...) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>old</code></td> <td> <p>a model formula to be updated.</p> </td></tr> <tr valign="top"><td><code>new</code></td> <td> <p>a formula giving a template which specifies how to update.</p> </td></tr> <tr valign="top"><td><code>...</code></td> <td> <p>further arguments passed to or from other methods.</p> </td></tr> </table> <h3>Details</h3> <p>Either or both of <code>old</code> and <code>new</code> can be objects such as length-one character vectors which can be coerced to a formula via <code><a href="formula.html">as.formula</a></code>. </p> <p>The function works by first identifying the <em>left-hand side</em> and <em>right-hand side</em> of the <code>old</code> formula. It then examines the <code>new</code> formula and substitutes the <em>lhs</em> of the <code>old</code> formula for any occurrence of ‘.’ on the left of <code>new</code>, and substitutes the <em>rhs</em> of the <code>old</code> formula for any occurrence of ‘.’ on the right of <code>new</code>. The result is then simplified <em>via</em> <code><a href="terms.formula.html">terms.formula</a>(simplify = TRUE)</code>. </p> <h3>Value</h3> <p>The updated formula is returned. The environment of the result is that of <code>old</code>. </p> <h3>See Also</h3> <p><code><a href="terms.html">terms</a></code>, <code><a href="model.matrix.html">model.matrix</a></code>. </p> <h3>Examples</h3> <pre> update(y ~ x, ~ . + x2) #> y ~ x + x2 update(y ~ x, log(.) ~ . ) #> log(y) ~ x update(. ~ u+v, res ~ . ) #> res ~ u + v </pre> <hr /><div style="text-align: center;">[Package <em>stats</em> version 3.6.0 <a href="00Index.html">Index</a>]</div> </body></html>