Re: [R] A coding question involving variable assignments

From: xpRt.wannabe <xprt.wannabe_at_gmail.com>
Date: Fri 12 Aug 2005 - 12:17:00 EST

Ted and List,

In your code that produced 'mx', you dropped sum() from my original code though. As a result, the 10 x 5 max's are of the same value. Unfortunately, that's not what I need.

On 8/11/05, ecatchpole <e.catchpole@adfa.edu.au> wrote:
> 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
>



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Fri Aug 12 12:21:41 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:39:47 EST