Round each element of a matrix/vector | R Documentation |
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>.
Lchoose, Log, Choose
x <-matrix( rnorm( 50 * 10), ncol = 10 )
a <- Round(x,5)
b <- round(x,5)
all.equal(a,b) #true
x <-rnorm( 1000)
a <- Round(x,5)
b <- round(x,5)
all.equal(a,b) # true
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.