Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

getRange

Function for rounding and/or segmenting a range.


Description

Function for rounding and/or segmenting a range.

Usage

getRange(x, dec = NULL, step = NULL, n.seg = 2)

Arguments

x

A numeric vector.

dec

Number of decimal points for rounding using function round. Applied after argument step. If NULL (default), no rounding is applied.

step

Round the

n.seg

Numeric value, number of values in the equally spaced sequence. Default is 2 (min, max).

Value

vector, range of equally spaced sequence.

Author(s)

Jacolien van Rij

See Also

Examples

zlim <- c(-2.5, 3.01)
# does not change anything:
getRange(zlim)
# create a range of 5 numbers: 
# (basically just using seq )
getRange(zlim, n.seg=5)
# rounds the numbers:
getRange(zlim, dec=0)
getRange(zlim, n.seg=5, dec=0)
# extreme values are multiplications of 5
# that contains zlim values:
getRange(zlim, step=5)
getRange(zlim, step=5, n.seg=5)
# similar, but not the same:
getRange(zlim, n.seg=5, dec=0)
getRange(zlim, n.seg=5, step=1)
# combining:
getRange(zlim, n.seg=5, step=1, dec=0)

plotfunctions

Various Functions to Facilitate Visualization of Data and Analysis

v1.4
GPL (>= 2)
Authors
Jacolien van Rij [aut, cre]
Initial release
2020-04-30

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.