Skip to content
Prev 349763 / 398513 Next

Verify that a grid is uniform

The first solution with diff works for uniform abscissa only with integer
values.

z <- seq(0, 10, length=100)
all(diff(z) == z[2] - z[1] )
## FALSE

In this case, as you recommended, I could use signif or round or a
tolerance for real numbers. In my particular case, in order to set a
tolerance, I need the scale used and I don't have this information. I
prefer to test the "near uniformity".
I didn't know the function zapsmall. It could be useful!
Thanks Sarah and Bert!!!

Marc





2015-04-06 19:51 GMT+02:00 Bert Gunter <gunter.berton at gene.com>: