Creating vector of results of repeated function calls in R

前端 未结 1 1894
一个人的身影
一个人的身影 2020-12-14 05:58

I have a function that uses runif to calculate some value, so each time it is called, the result varies slightly. I want to calculate the mean of the result of

1条回答
  •  时光说笑
    2020-12-14 06:36

    replicate is your friend. See ?replicate

    replicate(10, my_function_call()) # this would be what you're looking for
    

    0 讨论(0)
提交回复
热议问题