EVOLUTION-MANAGER
Edit File: fct_shift.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: Shift factor levels to left or right, wrapping around at end</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 fct_shift {forcats}"><tr><td>fct_shift {forcats}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Shift factor levels to left or right, wrapping around at end</h2> <h3>Description</h3> <p>This is useful when the levels of an ordered factor are actually cyclical, with different conventions on the starting point. </p> <h3>Usage</h3> <pre> fct_shift(f, n = 1L) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>f</code></td> <td> <p>A factor.</p> </td></tr> <tr valign="top"><td><code>n</code></td> <td> <p>Positive values shift to the left; negative values shift to the right.</p> </td></tr> </table> <h3>Examples</h3> <pre> x <- factor( c("Mon", "Tue", "Wed"), levels = c("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"), ordered = TRUE ) x fct_shift(x) fct_shift(x, 2) fct_shift(x, -1) </pre> <hr /><div style="text-align: center;">[Package <em>forcats</em> version 0.5.0 <a href="00Index.html">Index</a>]</div> </body></html>