Creates a vector of exponentially increasing values between 0 and a specified value `n`. If `n` is specified as 1, the vector will be scaled to between 0 and 1.

exp_seq(n, ln = 15, exponent = 2, round_values = TRUE, rmv_extremes = TRUE)

Arguments

n

The maximum value that the values in the sequence are scaled to.

ln

How long the vector should be (defaults to 15).

exponent

The exponential power with which to multiply the sequence by (defaults to 2).

round_values

Option to round values to whole numbers (defaults to `TRUE`). If `n` equals 1, round_values will automatically be set to FALSE.

rmv_extremes

Option to remove zero and the maximum value (i.e. `n`) from the beginning and the end of the returned vector (defaults to `FALSE`). Note that this will mean the length of the returned vector will be `n` - 2.

Value

A vector containing exponentially increasing values between 0 and a specified value `n`.

Examples

# Create sequence of length 8, scaled between 0 and 10000
exp_seq(10000,8)
#> [1]  204  816 1837 3265 5102 7347
# Set rmv_extremes = FALSE to get full sequence
exp_seq(10000,8,rmv_extremes = FALSE)
#> [1]     0   204   816  1837  3265  5102  7347 10000
# The exponent defaults to 2. Setting it to between 1 and 2 causes it to converge on
# a linear sequence. When exponent is set to 1 the sequence increases linearly
exp_seq(10000,8,exponent=1)
#> [1] 1429 2857 4286 5714 7143 8571
# Setting it to greater than 2 will cause it the values in the sequence to shift towards zero
exp_seq(10000,8,exponent=4)
#> [1]    4   67  337 1066 2603 5398

# Create sequence of length 12, scaled between 0 and 1
exp_seq(1,12)
#>  [1] 0.008264463 0.033057851 0.074380165 0.132231405 0.206611570 0.297520661
#>  [7] 0.404958678 0.528925620 0.669421488 0.826446281
exp_seq(1,12,rmv_extremes = FALSE)
#>  [1] 0.000000000 0.008264463 0.033057851 0.074380165 0.132231405 0.206611570
#>  [7] 0.297520661 0.404958678 0.528925620 0.669421488 0.826446281 1.000000000
exp_seq(1,12,exponent=1)
#>  [1] 0.09090909 0.18181818 0.27272727 0.36363636 0.45454545 0.54545455
#>  [7] 0.63636364 0.72727273 0.81818182 0.90909091
exp_seq(1,12,exponent=4)
#>  [1] 6.830135e-05 1.092822e-03 5.532409e-03 1.748514e-02 4.268834e-02
#>  [6] 8.851854e-02 1.639915e-01 2.797623e-01 4.481251e-01 6.830135e-01