# extendrange

##### Extend a Numerical Range by a Small Percentage

Extends a numerical range by a small percentage, i.e., fraction,
*on both sides*.

- Keywords
- dplot

##### Usage

`extendrange(x, r = range(x, na.rm = TRUE), f = 0.05)`

##### Arguments

- x
numeric vector; not used if

`r`

is specified.- r
numeric vector of length 2; defaults to the

`range`

of`x`

.- f
number specifying the fraction by which the range should be extended.

##### Value

A numeric vector of length 2, `r + c(-f,f) * diff(r)`

.

##### See Also

`range`

; `pretty`

which can be
considered a sophisticated extension of `extendrange`

.

##### Examples

`library(grDevices)`

```
# NOT RUN {
x <- 1:5
(r <- range(x)) # 1 5
extendrange(x) # 0.8 5.2
extendrange(x, f= 0.01) # 0.96 5.04
## Use 'r' if you have it already:
stopifnot(identical(extendrange(r = r),
extendrange(x)))
# }
```

*Documentation reproduced from package grDevices, version 3.5.2, License: Part of R 3.5.2*

### Community examples

Looks like there are no examples yet.