get_bounds: Get Lower/Upper Bounds of Numeric/Integer Sequence

Description Usage Arguments Value Examples

View source: R/other_utils.R

Description

Get Lower/Upper Bounds of Numeric/Integer Sequence

Usage

1
2
3
4
5
6
7
get_bounds(
  data,
  column_name,
  increment = 5,
  upper_shrink = FALSE,
  shrink_prop = 2/3
)

Arguments

data

a data frame with numeric or integer sequence.

column_name

character of column name.

increment

numeric, default 5. It is the increment of bounds.

upper_shrink

locical, default FALSE. If set TRUE and the shrink_prop of upper bound is larger than the maximum of target column, the actual upper column will use its maximum value.

shrink_prop

numeric, default is 0.66666.... This is the proportion of shrink threshold.

Value

numeric vector of length 2. The first is lower bound and the second is upper bound.

Examples

1
2
3
4
df <- data.frame(a = c(11, 23, 1), b = c(0.2, 0.3, 0.1))
get_bounds(df, 'a')
get_bounds(df, 'b', increment = 0.2)
get_bounds(df, 'b', increment = 0.4, upper_shrink = TRUE)

YuanchenZhu2020/antgreens documentation built on Dec. 18, 2021, 8:20 p.m.