Skip to content
Prev 229432 / 398500 Next

vector creation

dear all,

consider a simple function like
      func = function(){ return(runif()) }
and say that you would like to create a vector of size N, each entry being a
call to this function "func". What is the equivalent of the python code
      vect = [ func() for i in range(N)]
Indeed, you cannot just call  vect<-rep( func(), N)  -  I guess that there
also exists a one-liner to do that in R, doesn't it ?


Sorry for the very basic question!

Best,
Alek