logbreaks: logbreaks

Description Usage Arguments Details Value Examples

View source: R/logbreaks.R

Description

A function that allows to obtain histogram class limits following a logarithmic scale. It also has a parameter that allows to set the scale at your convenience.

Usage

1
2
3
4
5
6
7
8
logbreaks(
  x,
  parlist = list(alpha, J),
  round_breaks = 0,
  plot_breaks = FALSE,
  effect.threshold.begin = NA,
  effect.threshold.end = NA
)

Arguments

x

either a numeric vector to be partitioned or a numeric vector containing the minimum and maximum of the vector to be partitioned.

parlist

a list of 2 elements. The first one is alpha, a numeric and positive value. It is a parameter affecting the number of breaks closed to the minimum. The second one is J. It is a nonnegative and nonzero integer and represent the selected number of classes.

round_breaks

a nonnegative integer. Equal to 0 by default, it is the number of decimal values of the breaks.

plot_breaks

logical. FALSE by default. If TRUE, the breaks are plotted.

effect.threshold.begin

NA by default. Numeric value between the minimum and maximum of x. If it isn't NA, the first class is created with xmin and effect.threshold.begin.

effect.threshold.end

NA by default. Numeric value between the minimum and maximum of x. If it isn't NA, the last class is created with xmax and effect.threshold.end.

Details

The breaks are obtained as follows:

L(w) = \min(x) + \frac{e^{α \frac{w-1}{J}} - 1 }{e^{α}-1} (\max(x) -\min(x)), \ w= 1, …, J+1.

Value

The return is a numeric vector of length J+1 with the breaks obtained following a log scale.

Examples

1
2
logbreaks(c(10,1000), parlist=list(0.2,5))
logbreaks(c(10,1000), parlist=list(0.2,5),plot_breaks=TRUE)

SpiceFP documentation built on Sept. 15, 2021, 9:07 a.m.