Learn R Programming

pbdDMAT (version 0.2-3)

Round: Rounding of Numbers

Description

Extensions of R rounding functions for distributed matrices.

Usage

## S3 method for class 'ddmatrix':
ceiling(x)
## S3 method for class 'ddmatrix':
floor(x)

## S3 method for class 'ddmatrix': round(x, digits = 0)

Arguments

x
numeric distributed matrix
digits
integer indicating the number of decimal places (round()) or significant digits (signif()) to be used. Negative values are allowed (see 'Details').

Value

  • Returns a distributed matrix.

Details

Rounding to a negative number of digits means rounding to a power of ten, so for example round(x, digits = -2) rounds to the nearest hundred.

See Also

MiscMath, NAs

Examples

Run this code
# Save code in a file "demo.r" and run with 2 processors by
# > mpiexec -np 2 Rscript demo.r

library(pbdDMAT, quiet = TRUE)
init.grid()

# don't do this in production code
x <- matrix(1:9, 3)
x <- as.ddmatrix(x)

y <- ceiling(x/3)
print(y)

finalize()

Run the code above in your browser using DataLab