grow: Expand/grow a numeric range

Description Usage Arguments Details Value Author(s) Examples

Description

The grow method allows to expand a numeric range by a given number, i.e. the number specified with the argument by is subtracted from the lower bound and added to the upper bound, such that the range is grown by 2 * by.

Usage

1
2
3
4
5
## S4 method for signature 'numeric'
grow(x, by=NULL, ...)

## S4 method for signature 'matrix'
grow(x, by=NULL, ...)

Arguments

by

Numeric vector of length 1 (or with a length matching the number of rows of x if x is a matrix).

x

Either a numeric vector of length 2 specifying the lower and upper bound of the range or a numeric matrix with two columns each row specifying a range.

...

Presently not used.

Details

The function subtracts by from the first element of x and adds it to the second.

Value

Returns the numeric vector or matrix with expanded ranges.

Author(s)

Johannes Rainer

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Expand a numeric range.
grow(c(3, 4), by=4)

## Define a numeric matrix of ranges and expand them.
mat <- rbind(c(3, 4),
             c(11, 15),
             c(1, 4))
grow(mat, by=3)

## Specify a by for each row
grow(mat, by=c(1, 2, 3))

jotsetung/xcmsExtensions documentation built on May 19, 2019, 9:42 p.m.