rounding

0th

Percentile

Detect Numerical Rounding

Given a numeric vector, or an object containing numeric spatial coordinates, determine whether the values have been rounded to a certain number of decimal places.

Keywords
spatial, math
Usage
rounding(x)

## S3 method for class 'default': rounding(x)

## S3 method for class 'ppp': rounding(x)

## S3 method for class 'pp3': rounding(x)

## S3 method for class 'ppx': rounding(x)

Arguments
x
A numeric vector, or an object containing numeric spatial coordinates.
Details

For a numeric vector x, this function determines whether the values have been rounded to a certain number of decimal places.

  • If the entries ofxare 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 ofxare integers, thenrounding(x)returns-d, wheredis the smallest number of digitsbeforethe 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 ofxare equal to 0, the rounding is not determined, and a value ofNULLis returned.
For a point pattern (object of class "ppp") or similar object x containing numeric spatial coordinates, this procedure is applied to the spatial coordinates.

Value

  • An integer.

See Also

round.ppp

Aliases
  • rounding
  • rounding.default
  • rounding.ppp
  • rounding.pp3
  • rounding.ppx
Examples
rounding(c(0.1, 0.3, 1.2))
   rounding(c(1940, 1880, 2010))
   rounding(0)
   rounding(cells)
Documentation reproduced from package spatstat, version 1.31-3, License: GPL (>= 2)

Community examples

Looks like there are no examples yet.