floor_to {flexOR}R Documentation

floor_to: Rounds a number down

Description

Takes a numeric value or vector (x) and rounds it down to the nearest multiple of a specified base (to). If the to argument is not provided, it defaults to rounding down to the nearest integer. The result is returned as a numeric value or vector of the same length as the input.

Usage

floor_to(x, to = 1)

Arguments

x

numeric value or vector that you want to round down or floor.

to

the base to which you want to round down the input value(s). The default value is set to 1, meaning the function will round down to the nearest integer.

Value

The number rounded down to the specified multiple.

Examples

floor_to(7, 3); # Returns 6, as 6 is the largest multiple of 3 less than or equal to 7.
floor_to(5, 2); # Returns 4, as 4 is the largest multiple of 2 less than or equal to 5.


[Package flexOR version 1.0.0 Index]