quickround: Round data sets

Description Usage Arguments Details Value See Also Examples

View source: R/quickround.R

Description

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

Usage

1
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

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.

Value

A tbl object.

See Also

round_any

Examples

1
2
3
4
5
6
7
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

freqweights documentation built on May 29, 2017, 12:01 p.m.