Re: [R] Loop avoidance in simulating a vector

2008-10-17 Thread Greg Snow
to:[EMAIL PROTECTED] > project.org] On Behalf Of Ray Brownrigg > Sent: Thursday, October 16, 2008 2:36 PM > To: r-help@r-project.org > Cc: 'David Afshartous'; Bert Gunter > Subject: Re: [R] Loop avoidance in simulating a vector > > If you want to avoid using a loop, ra

Re: [R] Loop avoidance in simulating a vector

2008-10-16 Thread Ray Brownrigg
; using hidden interpreted loops). > > -- Bert Gunter > > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On > Behalf Of Christos Hatzis > Sent: Thursday, October 16, 2008 1:06 PM > To: 'David Afshartous'; r-help@r-project.org > Subject

Re: [R] Loop avoidance in simulating a vector

2008-10-16 Thread Christos Hatzis
TED]; 'David Afshartous'; > r-help@r-project.org > Subject: RE: [R] Loop avoidance in simulating a vector > > mapply is still a (disguised) loop (at the interpreted > level). So other than improving code readability (always a > good thing!), it shouldn't make mu

Re: [R] Loop avoidance in simulating a vector

2008-10-16 Thread Bert Gunter
[EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Christos Hatzis Sent: Thursday, October 16, 2008 1:06 PM To: 'David Afshartous'; r-help@r-project.org Subject: Re: [R] Loop avoidance in simulating a vector Have a look at mapply. -Christos > -Original Message- >

Re: [R] Loop avoidance in simulating a vector

2008-10-16 Thread Christos Hatzis
Have a look at mapply. -Christos > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of David Afshartous > Sent: Thursday, October 16, 2008 3:47 PM > To: r-help@r-project.org > Subject: [R] Loop avoidance in simulating a vector > &

[R] Loop avoidance in simulating a vector

2008-10-16 Thread David Afshartous
All, I'd like to simulate a vector that is formed from many distinct distributions and avoid a loop if possible. E.g, consider: mu = c(1, 2, 3) sigma = c(1, 2, 3) n = c(10, 10, 10) And we simulate a vector of length 30 that consists of N(mu[i], sigma[i]) distributed data, each of length n[i]