Report x- and y-range, generic function

Share:

Description

xyrange returns a list with elements x and y, vectors containing the minimum and maximum of x- and y-values the argument(s). This function serves to determine a plot region.

Usage

1
2
3
4
5
  rangexy(...)

  ## Default S3 method:
 rangexy(x, y = NULL, finite = TRUE,
    ...)

Arguments

x,y

numeric vectors of x- and y- coordinates, or alternatively a single argument x.

...

arguments passed to class methods, ignored in default method rangexy.default

finite

logical, indicating if all non-finite elements should be omitted.

Details

The default method passes the arguments x and y to function xy.coords. Therefore, reasonable results can also be expected when e.g. y is NULL and x is a list or data frame with components x and y.

If finite is TRUE, the minimum and maximum of all finite values is computed, and NA and NaN values are ignored.

Value

A list with elements x and y.

Author(s)

Ute Hahn, ute@imf.au.dk

See Also

xy.coords for details on possible values of x when y is NULL

Examples

1
2
3
df <- data.frame(x=1:4, y=(1:4)^2)
rangexy(df)
rangexy(1:4, 5:8)