round_any() Function of plyr Package in R
In this article, we will discuss the round_any() function with its examples from plyr() package in the R programming language.
Before knowing this, we have to install and load the plyr() package.
Syntax to install and load the plyr package in the R console:
Install: install.packages("plyr") Load: library("plyr")
round_any() function in r rounds to a multiple of any number that we have to specify within the round_any() function.Its syntax is as follows:
where, input_data may be a vector or a dataframe and value is the rounding value.
In this example, we are creating a vector with 5 elements from 1 to 5, and then calling the round_any() function passed with the vector and the rounding value to 1.3.
1] 1.3 2.6 2.6 3.9 5.2
In this example, we are using the same vector used in the previous example of 5 elements and here we are changing the value to the rounding value passed in the function round_any() to 1.9 to compare the changes with the previous example in the R language,.
 1.9 1.9 3.8 3.8 5.7