truncN: Functions for Truncating without Round

View source: R/other_functions.R

truncNR Documentation

Functions for Truncating without Round

Description

This set of functions truncates the numbers without rounding. Each function truncates the given number to the decimal points specified in the function itself.

This function truncates the numbers without rounding. Function truncates the given number to the decimal points specified in argument digits. Note that rounding is performed with 1 extra digits to correctly truncate the values as much as possible.

Usage

trunc0(x)

trunc1(x)

trunc2(x)

trunc3(x)

trunc4(x)

truncN(x, digits)

Arguments

x

numeric. A numeric vector.

digits

numeric. Truncating digits.

Value

Numeric value or vector.

Numeric value or vector.

Author(s)

Omer Kara

Examples

trunc0(2.67896)
trunc1(2.67896)
trunc2(2.67896)
trunc3(2.67896)
trunc4(2.67896)

truncN(2.67896, digits = 0)
truncN(2.67896, digits = 1)
truncN(2.67896, digits = 2)
truncN(2.67896, digits = 3)
truncN(2.67896, digits = 4)


omerkara/okara documentation built on Nov. 21, 2023, 7:56 p.m.