[R] vector creation

alekk alek.thiery at gmail.com
Sat Jul 31 15:01:49 CEST 2010


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
-- 
View this message in context: http://r.789695.n4.nabble.com/vector-creation-tp2308840p2308840.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list