EVOLUTION-MANAGER
Edit File: Extract.factor.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: Extract or Replace Parts of a Factor</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 Extract.factor {base}"><tr><td>Extract.factor {base}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Extract or Replace Parts of a Factor</h2> <h3>Description</h3> <p>Extract or replace subsets of factors. </p> <h3>Usage</h3> <pre> ## S3 method for class 'factor' x[..., drop = FALSE] ## S3 method for class 'factor' x[[...]] ## S3 replacement method for class 'factor' x[...] <- value ## S3 replacement method for class 'factor' x[[...]] <- value </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>x</code></td> <td> <p>a factor</p> </td></tr> <tr valign="top"><td><code>...</code></td> <td> <p>a specification of indices – see <code><a href="Extract.html">Extract</a></code>.</p> </td></tr> <tr valign="top"><td><code>drop</code></td> <td> <p>logical. If true, unused levels are dropped.</p> </td></tr> <tr valign="top"><td><code>value</code></td> <td> <p>character: a set of levels. Factor values are coerced to character.</p> </td></tr> </table> <h3>Details</h3> <p>When unused levels are dropped the ordering of the remaining levels is preserved. </p> <p>If <code>value</code> is not in <code>levels(x)</code>, a missing value is assigned with a warning. </p> <p>Any <code><a href="../../stats/html/contrasts.html">contrasts</a></code> assigned to the factor are preserved unless <code>drop = TRUE</code>. </p> <p>The <code>[[</code> method supports argument <code>exact</code>. </p> <h3>Value</h3> <p>A factor with the same set of levels as <code>x</code> unless <code>drop = TRUE</code>. </p> <h3>See Also</h3> <p><code><a href="factor.html">factor</a></code>, <code><a href="Extract.html">Extract</a></code>. </p> <h3>Examples</h3> <pre> ## following example(factor) (ff <- factor(substring("statistics", 1:10, 1:10), levels = letters)) ff[, drop = TRUE] factor(letters[7:10])[2:3, drop = TRUE] </pre> <hr /><div style="text-align: center;">[Package <em>base</em> version 3.6.0 <a href="00Index.html">Index</a>]</div> </body></html>