Re: [R] vector creation

2010-07-31 Thread David Winsemius
On Jul 31, 2010, at 10:21 AM, Berend Hasselman wrote: On 31-07-2010, at 16:12, alekk [via R] wrote: sorry for being unclear: my function func() is actually more complicated than that, and uses random numbers to generate its result. If I run something like vect = rep(func(), N) I will

Re: [R] vector creation

2010-07-31 Thread alekk
sorry for being unclear: my function func() is actually more complicated than that, and uses random numbers to generate its result. If I run something like vect = rep(func(), N) I will get something like (x,x,x, ... ,x). What is the right way to do that ? Thanks! -- View this message in

[R] vector creation

2010-07-31 Thread alekk
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 jus

Re: [R] vector creation

2010-07-31 Thread Berend Hasselman
On 31-07-2010, at 16:12, alekk [via R] wrote: > sorry for being unclear: > my function func() is actually more complicated than that, and uses random > numbers to generate its result. If I run something like > vect = rep(func(), N) > I will get something like (x,x,x, ... ,x). > > Wha

Re: [R] vector creation

2010-07-31 Thread Berend Hasselman
alekk wrote: > > 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)] > Inde