round_n: Round to a specified integer

Description Usage Arguments Value Examples

Description

This function rounds a number to a specified integer. If x is a data.frame then rounding is applied to all numeric variables. The function round_5 gives a particularly common use case, as published data is often rounded to the nearest 5 for disclosure control.

Usage

1
2
3
round_n(x, n)

round_5(x)

Arguments

x

A numeric vector or a data.frame.

n

An integer to round to.

Value

A numeric vector or a data.frame.

Examples

1
2
3
4
round_n(16, 5)
round_n(c(7, 16, NA), 5)
round_n(iris, 5)
round_5(iris)

leebunce/leebunce documentation built on May 20, 2019, 4:06 p.m.