Skip to contents

stm_logspace() generates a vector of logarithmically spaced values from from to to, using a logarithmic scale with base 10.

Usage

stm_logspace(from, to, n = 50, digits = NULL)

Arguments

from

A numeric value representing the start of the sequence in logarithmic space.

to

A numeric value representing the end of the sequence in logarithmic space.

n

Optional. A positive integer specifying the number of points in the sequence. Default is 50.

digits

Optional. An integer specifying the number of decimal places to round the result. Default is NULL.

Value

A numeric vector of length n with logarithmically spaced values from 10^from to 10^to.

Details

This function creates a sequence of values with logarithmic spacing, which is useful for visualizing data with a wide range or for numerical methods involving logarithms. If digits is provided, the resulting vector will be rounded to the specified number of decimal places.

Examples

stm_logspace(from = 1, to = 5, n = 7)
#> [1]     10.00000     46.41589    215.44347   1000.00000   4641.58883
#> [6]  21544.34690 100000.00000
stm_logspace(from = 0, to = 1, n = 7, digits = 2)
#> [1]  1.00  1.47  2.15  3.16  4.64  6.81 10.00