>> >> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
>> >> On Behalf Of Pascal Oettli
>> >> Sent: Friday, March 16, 2012 12:36 AM
>> >> To: Raphael Fraser
>> >> Cc: r-help@r-project.org
>> >>
rdlund
> wrote:
> >
> >> -Original Message-
> >> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
> >> On Behalf Of Pascal Oettli
> >> Sent: Friday, March 16, 2012 12:36 AM
> >> To: Raphael Fraser
> >> Cc:
ay, March 16, 2012 12:36 AM
>> To: Raphael Fraser
>> Cc: r-help@r-project.org
>> Subject: [R] Re : Elegant Code
>>
>> Hi Raphael,
>>
>> Something like that?
>>
>> require(pscl)sim <- numeric()
>> for(i in 1:5){
>> eval(parse(text
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
> On Behalf Of Pascal Oettli
> Sent: Friday, March 16, 2012 12:36 AM
> To: Raphael Fraser
> Cc: r-help@r-project.org
> Subject: [R] Re : Elegant Code
>
> Hi Raphae
Hi Raphael,
Something like that?
require(pscl)sim <- numeric()
for(i in 1:5){
eval(parse(text=paste('b',i,' <- rigamma(50,1,1)',sep='')))
eval(parse(text=paste('theta',i,' <- rgamma(50,0.5,(1/b',i,'))',sep='')))
eval(parse(text=paste('sim',i,' <- rpois(50,theta',1,')',sep='')))
eval(parse
5 matches
Mail list logo