EVOLUTION-MANAGER
Edit File: format.info.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: format(.) Information</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 format.info {base}"><tr><td>format.info {base}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>format(.) Information</h2> <h3>Description</h3> <p>Information is returned on how <code><a href="format.html">format</a>(x, digits, nsmall)</code> would be formatted. </p> <h3>Usage</h3> <pre> format.info(x, digits = NULL, nsmall = 0) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>x</code></td> <td> <p>an atomic vector; a potential argument of <code><a href="format.html">format</a>(x, ...)</code>.</p> </td></tr> <tr valign="top"><td><code>digits</code></td> <td> <p>how many significant digits are to be used for numeric and complex <code>x</code>. The default, <code>NULL</code>, uses <code><a href="options.html">getOption</a>("digits")</code>.</p> </td></tr> <tr valign="top"><td><code>nsmall</code></td> <td> <p> (see <code><a href="format.html">format</a>(..., nsmall)</code>).</p> </td></tr> </table> <h3>Value</h3> <p>An <code><a href="integer.html">integer</a></code> <code><a href="vector.html">vector</a></code> of length 1, 3 or 6, say <code>r</code>. </p> <p>For logical, integer and character vectors a single element, the width which would be used by <code>format</code> if <code>width = NULL</code>. </p> <p>For numeric vectors: </p> <table summary="R valueblock"> <tr valign="top"><td><code>r[1]</code></td> <td> <p>width (in characters) used by <code>format(x)</code></p> </td></tr> <tr valign="top"><td><code>r[2]</code></td> <td> <p>number of digits after decimal point.</p> </td></tr> <tr valign="top"><td><code>r[3]</code></td> <td> <p>in <code>0:2</code>; if <i>≥</i><code>1</code>, <em>exponential</em> representation would be used, with exponent length of <code>r[3]+1</code>.</p> </td></tr> </table> <p>For a complex vector the first three elements refer to the real parts, and there are three further elements corresponding to the imaginary parts. </p> <h3>See Also</h3> <p><code><a href="format.html">format</a></code> (notably about <code>digits >= 16</code>), <code><a href="formatc.html">formatC</a></code>. </p> <h3>Examples</h3> <pre> dd <- options("digits") ; options(digits = 7) #-- for the following format.info(123) # 3 0 0 format.info(pi) # 8 6 0 format.info(1e8) # 5 0 1 - exponential "1e+08" format.info(1e222) # 6 0 2 - exponential "1e+222" x <- pi*10^c(-10,-2,0:2,8,20) names(x) <- formatC(x, width = 1, digits = 3, format = "g") cbind(sapply(x, format)) t(sapply(x, format.info)) ## using at least 8 digits right of "." t(sapply(x, format.info, nsmall = 8)) # Reset old options: options(dd) </pre> <hr /><div style="text-align: center;">[Package <em>base</em> version 3.6.0 <a href="00Index.html">Index</a>]</div> </body></html>