| rounding {spatstat.univar} | R Documentation |
Detect Numerical Rounding
Description
Given a numeric vector, determine whether the values have been rounded to a certain number of decimal places.
Usage
rounding(x)
## Default S3 method:
rounding(x)
Arguments
x |
A numeric vector, or an object containing numeric spatial coordinates. |
Details
The function rounding is generic.
Its purpose is to determine whether numerical values have been rounded
to a certain number of decimal places.
The spatstat family of packages provides methods for
rounding for various spatial objects.
For a numeric vector x, the default method rounding.default
determines whether the values in x have been rounded
to a certain number of decimal places.
-
If the entries of
xare not all integers, thenrounding(x)returns the smallest number of digitsdafter the decimal point such thatround(x, digits=d)is identical tox. For example ifrounding(x) = 2then the entries ofxare rounded to 2 decimal places, and are multiples of 0.01. -
If all the entries of
xare integers, thenrounding(x)returns-d, wheredis the smallest number of digits before the decimal point such thatround(x, digits=-d)is identical tox. For example ifrounding(x) = -3then the entries ofxare multiples of 1000. Ifrounding(x) = 0then the entries ofxare integers but not multiples of 10. -
If all entries of
xare equal to 0, a value of 0 is returned.
Value
An integer.
Author(s)
Adrian Baddeley Adrian.Baddeley@curtin.edu.au and Rolf Turner rolfturner@posteo.net
See Also
round.ppp in package spatstat.geom.
Examples
rounding(c(0.1, 0.3, 1.2))
rounding(c(1940, 1880, 2010))
rounding(0)