Is there some way to access the current replication number in the replicate
function so I can use it as a variable in the repeated evaluation? For example in this trivial example I'd like to use the current replication number to generate a list of variable length vectors of the current replication number. For example, x
below would represent the current replicate:
replicate( 3 , rep( x , sample.int(5,1) ) )
I know this trivial example is easy to do with lapply
lapply( 1:3 , function(x) rep( x , sample.int(5,1) ) )
But can you access the replication counter in replicate
?