| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/options.R |
| 3 |
\name{units_options} |
| 4 |
\alias{units_options} |
| 5 |
\title{set one or more units global options} |
| 6 |
\usage{ |
| 7 |
units_options(..., sep, group, negative_power, parse, set_units_mode, |
| 8 |
strict_tokenizer, auto_convert_names_to_symbols, simplify, allow_mixed, |
| 9 |
unitless_symbol, define_bel) |
| 10 |
} |
| 11 |
\arguments{ |
| 12 |
\item{...}{named options (character) for which the value is queried} |
| 13 |
|
| 14 |
\item{sep}{character length two; default \code{c("~", "~")}; space separator between variable and units, and space separator between two different units} |
| 15 |
|
| 16 |
\item{group}{character length two; start and end group, may be two empty strings, a parenthesis pair, or square brackets; default: square brackets.} |
| 17 |
|
| 18 |
\item{negative_power}{logical, default \code{FALSE}; should denominators have negative power, or follow a division symbol?} |
| 19 |
|
| 20 |
\item{parse}{logical, default \code{TRUE}; should the units be made into an expression (so we get subscripts)? Setting to \code{FALSE} may be useful if \link{parse} fails, e.g. if the unit contains symbols that assume a particular encoding} |
| 21 |
|
| 22 |
\item{set_units_mode}{character; either \code{"symbols"} or \code{"standard"}; see \link{set_units}; default is \code{"symbols"}} |
| 23 |
|
| 24 |
\item{strict_tokenizer}{logical, default \code{FALSE}; non-strict tokenization attaches constants to the following symbol.} |
| 25 |
|
| 26 |
\item{auto_convert_names_to_symbols}{logical, default \code{TRUE}: should names, such as \code{degree_C} be converted to their usual symbol?} |
| 27 |
|
| 28 |
\item{simplify}{logical, default \code{NA}; simplify units in expressions?} |
| 29 |
|
| 30 |
\item{allow_mixed}{logical; if \code{TRUE}, combining mixed units creates a \code{mixed_units} object, if \code{FALSE} it generates an error} |
| 31 |
|
| 32 |
\item{unitless_symbol}{character; set the symbol to use for unitless (1) units} |
| 33 |
|
| 34 |
\item{define_bel}{logical; if \code{TRUE}, define the unit \code{B} (i.e., the \emph{bel}, widely used with the \emph{deci-} prefix as \code{dB}, \emph{decibel}) as an alias of \code{lg(re 1)}. \code{TRUE} by default, unless \code{B} is already defined in the existing XML database.} |
| 35 |
} |
| 36 |
\value{ |
| 37 |
in case options are set, invisibly a named list with the option values that are being set; if an option is queried, the current option value. |
| 38 |
} |
| 39 |
\description{ |
| 40 |
set units global options, mostly related how units are printed and plotted |
| 41 |
} |
| 42 |
\details{ |
| 43 |
This sets or gets units options. Set them by using named arguments, get them by passing the option name. |
| 44 |
|
| 45 |
The default \code{NA} value for \code{simplify} means units are not simplified in \link{set_units} or \link{as_units}, but are simplified in arithmetical expressions. |
| 46 |
} |
| 47 |
\examples{ |
| 48 |
old = units_options(sep = c("~~~", "~"), group = c("", "")) # more space, parenthesis |
| 49 |
old |
| 50 |
## set back to defaults: |
| 51 |
units_options(sep = c("~", "~"), group = c("[", "]"), negative_power = FALSE, parse = TRUE) |
| 52 |
units_options("group") |
| 53 |
} |