EVOLUTION-MANAGER
Edit File: label_dollar.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: Label currencies ($100, $2.50, etc)</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 label_dollar {scales}"><tr><td>label_dollar {scales}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Label currencies ($100, $2.50, etc)</h2> <h3>Description</h3> <p>Format numbers as currency, rounding values to dollars or cents using a convenient heuristic. </p> <h3>Usage</h3> <pre> label_dollar( accuracy = NULL, scale = 1, prefix = "$", suffix = "", big.mark = ",", decimal.mark = ".", trim = TRUE, largest_with_cents = 1e+05, negative_parens = FALSE, ... ) dollar_format( accuracy = NULL, scale = 1, prefix = "$", suffix = "", big.mark = ",", decimal.mark = ".", trim = TRUE, largest_with_cents = 1e+05, negative_parens = FALSE, ... ) dollar( x, accuracy = NULL, scale = 1, prefix = "$", suffix = "", big.mark = ",", decimal.mark = ".", trim = TRUE, largest_with_cents = 1e+05, negative_parens = FALSE, ... ) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>accuracy, largest_with_cents</code></td> <td> <p>Number to round to. If <code>NULL</code>, the default, values will be rounded to the nearest integer, unless any of the values has non-zero fractional component (e.g. cents) and the largest value is less than <code>largest_with_cents</code> which by default is 100,000.</p> </td></tr> <tr valign="top"><td><code>scale</code></td> <td> <p>A scaling factor: <code>x</code> will be multiplied by <code>scale</code> before formating. This is useful if the underlying data is very small or very large.</p> </td></tr> <tr valign="top"><td><code>prefix, suffix</code></td> <td> <p>Symbols to display before and after value.</p> </td></tr> <tr valign="top"><td><code>big.mark</code></td> <td> <p>Character used between every 3 digits to separate thousands.</p> </td></tr> <tr valign="top"><td><code>decimal.mark</code></td> <td> <p>The character to be used to indicate the numeric decimal point.</p> </td></tr> <tr valign="top"><td><code>trim</code></td> <td> <p>Logical, if <code>FALSE</code>, values are right-justified to a common width (see <code><a href="../../base/html/format.html">base::format()</a></code>).</p> </td></tr> <tr valign="top"><td><code>negative_parens</code></td> <td> <p>Display negative using parentheses?</p> </td></tr> <tr valign="top"><td><code>...</code></td> <td> <p>Other arguments passed on to <code><a href="../../base/html/format.html">base::format()</a></code>.</p> </td></tr> <tr valign="top"><td><code>x</code></td> <td> <p>A numeric vector</p> </td></tr> </table> <h3>Value</h3> <p>All <code>label_()</code> functions return a "labelling" function, i.e. a function that takes a vector <code>x</code> and returns a character vector of <code>length(x)</code> giving a label for each input value. </p> <p>Labelling functions are designed to be used with the <code>labels</code> argument of ggplot2 scales. The examples demonstrate their use with x scales, but they work similarly for all scales, including those that generate legends rather than axes. </p> <h3>Old interface</h3> <p><code>dollar()</code> and <code>format_dollar()</code> are retired; please use <code>label_dollar()</code> instead. </p> <h3>See Also</h3> <p>Other labels for continuous scales: <code><a href="label_bytes.html">label_bytes</a>()</code>, <code><a href="label_number_auto.html">label_number_auto</a>()</code>, <code><a href="label_number_si.html">label_number_si</a>()</code>, <code><a href="label_ordinal.html">label_ordinal</a>()</code>, <code><a href="label_parse.html">label_parse</a>()</code>, <code><a href="label_percent.html">label_percent</a>()</code>, <code><a href="label_pvalue.html">label_pvalue</a>()</code>, <code><a href="label_scientific.html">label_scientific</a>()</code> </p> <h3>Examples</h3> <pre> demo_continuous(c(0, 1), labels = label_dollar()) demo_continuous(c(1, 100), labels = label_dollar()) # Customise currency display with prefix and suffix demo_continuous(c(1, 100), labels = label_dollar(prefix = "USD ")) euro <- dollar_format( prefix = "", suffix = "\u20ac", big.mark = ".", decimal.mark = "," ) demo_continuous(c(1000, 1100), labels = euro) # Use negative_parens = TRUE for finance style display demo_continuous(c(-100, 100), labels = label_dollar(negative_parens = TRUE)) </pre> <hr /><div style="text-align: center;">[Package <em>scales</em> version 1.1.1 <a href="00Index.html">Index</a>]</div> </body></html>