Learn R Programming

pxmake (version 0.17.0)

px_precision: PRECISION

Description

Inspect or change PRECISION.

Usage

px_precision(x, value, validate)

# S3 method for px px_precision(x, value, validate = TRUE)

Value

A px object or data frame.

Arguments

x

A px object

value

Optional. A data frame with the columns 'precision' and one or more of the columns: 'variable-code', and 'code'. If 'value' is missing, the current PRECISION is returned. If NULL, PRECISION is removed.

validate

Optional. If TRUE a number of validation checks are performed on the px object, and an error is thrown if the object is not valid. If FALSE, the checks are skipped, which can be usefull for large px objects where the check can be time consuming. Use px_validate() to manually preform the check.

See Also

Examples

Run this code
# Set PRECISION for a variable
library(tibble)
x1 <-
  population_gl |>
  px() |>
  px_precision(tribble(~`variable-code`, ~precision,
                       'gender', 2))

# Print PRECISION
px_precision(x1)

# Set PRECISION for a value
x2 <-
  x1 |>
  px_precision(tribble(~`variable-code`, ~code, ~precision,
                       'age', '2004', 3))
px_precision(x2)

# Remove PRECISION
x3 <- px_precision(x2, NULL)
px_precision(x3)

Run the code above in your browser using DataLab