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

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.
You need to agree with the terms to proceed

Menu
Top