EVOLUTION-MANAGER
Edit File: tabs_as_spaces.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: Replace Tabs With Spaces</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 tabs_as_spaces {fansi}"><tr><td>tabs_as_spaces {fansi}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Replace Tabs With Spaces</h2> <h3>Description</h3> <p>Finds horizontal tab characters (0x09) in a string and replaces them with the spaces that produce the same horizontal offset. </p> <h3>Usage</h3> <pre> tabs_as_spaces(x, tab.stops = getOption("fansi.tab.stops"), warn = getOption("fansi.warn"), ctl = "all") </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>x</code></td> <td> <p>character vector or object coercible to character; any tabs therein will be replaced.</p> </td></tr> <tr valign="top"><td><code>tab.stops</code></td> <td> <p>integer(1:n) indicating position of tab stops to use when converting tabs to spaces. If there are more tabs in a line than defined tab stops the last tab stop is re-used. For the purposes of applying tab stops, each input line is considered a line and the character count begins from the beginning of the input line.</p> </td></tr> <tr valign="top"><td><code>warn</code></td> <td> <p>TRUE (default) or FALSE, whether to warn when potentially problematic <em>Control Sequences</em> are encountered. These could cause the assumptions <code>fansi</code> makes about how strings are rendered on your display to be incorrect, for example by moving the cursor (see <a href="fansi.html">fansi</a>).</p> </td></tr> <tr valign="top"><td><code>ctl</code></td> <td> <p>character, which <em>Control Sequences</em> should be treated specially. See the "_ctl vs. _sgr" section for details. </p> <ul> <li><p> "nl": newlines. </p> </li> <li><p> "c0": all other "C0" control characters (i.e. 0x01-0x1f, 0x7F), except for newlines and the actual ESC (0x1B) character. </p> </li> <li><p> "sgr": ANSI CSI SGR sequences. </p> </li> <li><p> "csi": all non-SGR ANSI CSI sequences. </p> </li> <li><p> "esc": all other escape sequences. </p> </li> <li><p> "all": all of the above, except when used in combination with any of the above, in which case it means "all but". </p> </li></ul> </td></tr> </table> <h3>Details</h3> <p>Since we do not know of a reliable cross platform means of detecting tab stops you will need to provide them yourself if you are using anything outside of the standard tab stop every 8 characters that is the default. </p> <h3>Value</h3> <p>character, <code>x</code> with tabs replaced by spaces, with elements possibly converted to UTF-8. </p> <h3>Note</h3> <p>Non-ASCII strings are converted to and returned in UTF-8 encoding. The <code>ctl</code> parameter only affects which <em>Control Sequences</em> are considered zero width. Tabs will always be converted to spaces, irrespective of the <code>ctl</code> setting. </p> <h3>See Also</h3> <p><a href="fansi.html">fansi</a> for details on how <em>Control Sequences</em> are interpreted, particularly if you are getting unexpected results. </p> <h3>Examples</h3> <pre> string <- '1\t12\t123\t1234\t12345678' tabs_as_spaces(string) writeLines( c( '-------|-------|-------|-------|-------|', tabs_as_spaces(string) ) ) writeLines( c( '-|--|--|--|--|--|--|--|--|--|--|', tabs_as_spaces(string, tab.stops=c(2, 3)) ) ) writeLines( c( '-|--|-------|-------|-------|', tabs_as_spaces(string, tab.stops=c(2, 3, 8)) ) ) </pre> <hr /><div style="text-align: center;">[Package <em>fansi</em> version 0.4.1 <a href="00Index.html">Index</a>]</div> </body></html>