Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ARROW-13886 [R] Expand documentation for decimal() #11758

Closed
wants to merge 11 commits into from
23 changes: 21 additions & 2 deletions r/R/type.R
Original file line number Diff line number Diff line change
Expand Up @@ -181,14 +181,33 @@ NestedType <- R6Class("NestedType", inherit = DataType)
#' `bit64::integer64` object) by setting `options(arrow.int64_downcast =
#' FALSE)`.
#'
#' `decimal()` creates a `decimal128` type. Arrow decimals are fixed-point
dragosmg marked this conversation as resolved.
Show resolved Hide resolved
#' decimal numbers encoded as a scalar integer. The `precision` is the number of
#' significant digits that the decimal type can represent; the `scale` is the
#' number of digits after the decimal point. For example, the number 1234.567
#' has a precision of 7 and a scale of 3. Note that `scale` can be negative.
#'
#' As an example, `decimal(7, 3)` can exactly represent the numbers 1234.567 and
#' -1234.567 (encoded internally as the 128-bit integers 1234567 and -1234567,
#' respectively), but neither 12345.67 nor 123.4567.
#'
#' `decimal(5, -3)` can exactly represent the number 12345000 (encoded
#' internally as the 128-bit integer 12345), but neither 123450000 nor 1234500.
dragosmg marked this conversation as resolved.
Show resolved Hide resolved
#' The `scale` can be thought of as an argument that controls rounding. When
#' negative, `scale` causes the number to be expressed using scientific notation
#' and power of 10.
#'
#' @param unit For time/timestamp types, the time unit. `time32()` can take
#' either "s" or "ms", while `time64()` can be "us" or "ns". `timestamp()` can
#' take any of those four values.
#' @param timezone For `timestamp()`, an optional time zone string.
#' @param byte_width byte width for `FixedSizeBinary` type.
#' @param list_size list size for `FixedSizeList` type.
#' @param precision For `decimal()`, precision
#' @param scale For `decimal()`, scale
#' @param precision For `decimal()`, the number of significant digits
#' the arrow `decimal` type can represent. The maximum precision for
#' `decimal()` is 38 significant digits.
#' @param scale For `decimal()`, the number of digits after the decimal
#' point. It can be negative.
dragosmg marked this conversation as resolved.
Show resolved Hide resolved
#' @param type For `list_of()`, a data type to make a list-of-type
#' @param ... For `struct()`, a named list of types to define the struct columns
#'
Expand Down
23 changes: 21 additions & 2 deletions r/man/data-type.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.