freqweights (version 1.0.1)

quickround: Round data sets

Description

A wrapper of round_any to round data sets to multiple of any number.

Usage

quickround(x, accuracy)

Arguments

x
a tbl object or a numeric or POSIXct matrix
accuracy
number to round to; for POSIXct objects, a number of seconds

Value

  • A tbl object.

Details

The x may contain non numerical varibles (factor, character, logical). They will remain unchanged. The numerical or time variables will be rounded to a multiple fo the accuracy.

If accuracy is of length 1, then this value is applied to all the columns of the data set. Otherwise, its length must be the same as the number of columns of x, including non numerical variables. If any value if NA, the corresponding variable will remain unchanged.

See Also

round_any

Examples

Run this code
quickround(iris,0.2)
quickround(iris[,1:3],c(0.2,0.5,1.0))

tfq <- tablefreq(iris, vars=c("Sepal.Length","Species"))
a <- quickround(tfq, c(0.3, NA, NA))
b <- tablefreq(a, freq="freq")
b

Run the code above in your browser using DataLab