Learn R Programming

edpclient (version 0.5.1)

precision: Precisions

Description

Get or set precisions of columns on a data frame

Usage

precision(col)
precision(col) <- value

Arguments

col

a column in a data frame

value

a two-element numeric vector, or NULL if no precision is set

Value

a two-element numeric vector

Details

In EDP, numeric columns in a population have optional "precisions," which are two-element numeric values. Either the first or second must be 1. The other must be a positive integer (which may also be one). For example, c(100, 1) means the column is measured in units of hundreds, and c(1, 4) means the column is measured in units of 0.25.

These functions get and set the precision on a data frame column you will build a population from; you can also get the precision of a column from select or simulate.

Examples

Run this code
# NOT RUN {
  d <- data.frame(x = c(1.0, 2.5, -2.5), y = runif(3))
  precision(d$x) <- c(1, 2)
  px <- precision(d$x)  # returns c(1, 2)
  py <- precision(d$y)  # returns NULL
  
# }

Run the code above in your browser using DataLab