How to Apply the replicate() Function in R (Example Code)
In this article you’ll learn how to perform a repeated evaluation of an expression using the replicate function in R.
Example: Application of replicate() Function in R
set.seed(34682533) # Set seed for reproducibility replicate(5, rpois(1, 3) + 5) # Using replicate() function # [1] 7 10 8 8 7 |
set.seed(34682533) # Set seed for reproducibility replicate(5, rpois(1, 3) + 5) # Using replicate() function # [1] 7 10 8 8 7