The “rlnorm” Function in R
Package: Base R (no specific package required)
Purpose: Generates random numbers from a log-normal distribution.
General Class: Random Number Generation
Required Argument(s):
n: The number of random values to generate.
meanlog: The mean of the natural logarithm of the distribution.
sdlog: The standard deviation of the natural logarithm of the distribution.
Notable Optional Arguments:
None.
Example:
# Generate 100 random values from a log-normal distribution
random_values <- rlnorm(n = 100, meanlog = 0, sdlog = 1)
print(random_values)In this example, the rlnorm function is used to generate 100 random values from a log-normal distribution with a mean of the natural logarithm equal to 0 and a standard deviation of the natural logarithm equal to 1. The generated values are then printed to the console.