Round each element of a matrix/vector
Round each element of a matrix/vector.
Round(x,digit=0,na.rm = FALSE)
x |
A numeric matrix/vector with data or NA. NOT integer values. |
digit |
An integer value for 0...N-1 where N is the number of the digits. By default is 0. |
na.rm |
TRUE or FAlSE for remove NAs if exists. |
Round is a very fast C++ implementation. Especially for large data. It handles NA.
A vector/matrix where each element is been rounded in the given digit.
Manos Papadakis
R implementation and documentation: Manos Papadakis <papadakm95@gmail.com>.
x <-matrix( rnorm( 500 * 100), ncol = 100 ) system.time( a <- Round(x,5) ) system.time( b <- round(x,5) ) all.equal(a,b) #true x <-rnorm( 1000) system.time( a <- Round(x,5) ) system.time( b <- round(x,5) ) all.equal(a,b) # true
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.