The “rpois” Function in R
Package: Base R (no specific package required)
Purpose: Generates random numbers from a Poisson distribution.
General Class: Random Number Generation
Required Argument(s):
n: The number of random values to generate.
lambda: The rate or mean of the Poisson distribution. The default is 1.
Notable Optional Arguments:
None.
Example:
# Generate 100 random values from a Poisson distribution with mean 3
random_values <- rpois(n = 100, lambda = 3)
print(random_values)In this example, the rpois function is used to generate 100 random values from a Poisson distribution with a mean of 3. The generated values are then printed to the console.