# resolution

From ggplot2 v2.1.0
by Hadley Wickham

##### Compute the "resolution" of a data vector.

The resolution is is the smallest non-zero distance between adjacent values. If there is only one unique value, then the resolution is defined to be one.

##### Usage

`resolution(x, zero = TRUE)`

##### Arguments

- x
- numeric vector
- zero
- should a zero value be automatically included in the computation of resolution

##### Details

If x is an integer vector, then it is assumed to represent a discrete variable, and the resolution is 1.

##### Examples

```
resolution(1:10)
resolution((1:10) - 0.5)
resolution((1:10) - 0.5, FALSE)
resolution(c(1,2, 10, 20, 50))
resolution(as.integer(c(1, 10, 20, 50))) # Returns 1
```

*Documentation reproduced from package ggplot2, version 2.1.0, License: GPL-2*

### Community examples

Looks like there are no examples yet.