Message-ID: <42FBEC03.1050103@adfa.edu.au>
Date: 2005-08-12T00:23:31Z
From: ecatchpole
Subject: A coding question involving variable assignments
In-Reply-To: <a4fecdd705081112552ce6b904@mail.gmail.com>
On 12/08/05 05:55, xpRt.wannabe wrote,:
> Dear List,
>
> I have the following code that does what I want:
>
> x <- replicate(5,replicate(10,sum(rnorm(rpois(1,10)))))
>
> How might one change it such that the maximum value generated by
> rnorm(rpois(1,10)) can be retrieved for later use?
set.seed(99)
x <- replicate(5,replicate(10,sum(rnorm(rpois(1,10)))))
set.seed(99)
mx <- replicate(5,replicate(10,max(rnorm(rpois(1,10)))))
should work?
Ted.
--
Dr E.A. Catchpole
Visiting Fellow
Univ of New South Wales at ADFA, Canberra, Australia
and University of Kent, Canterbury, England
- www.ma.adfa.edu.au/~eac
- fax: +61 2 6268 8786
- ph: +61 2 6268 8895