Re: [R] Simulating distribution of max of two die

2011-08-31 Thread Greg Snow
thcare greg.s...@imail.org 801.408.8111 > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of Jaap van Wyk > Sent: Monday, August 29, 2011 9:57 PM > To: r-help@r-project.org > Subject: [R] Simulating distrib

Re: [R] Simulating distribution of max of two die

2011-08-30 Thread S Ellison
> -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of Jaap van Wyk > Sent: 30 August 2011 04:57 > To: r-help@r-project.org > Subject: [R] Simulating distribution of max of two die > > how to find

Re: [R] Simulating distribution of max of two die

2011-08-29 Thread Jeff Newmiller
Why not d <- ifelse( d1 > d2, d1, d2 ) or d <- pmax( d1, d2 ) ? Apply operations may seem "beautiful", but I think the speed and simplicity of vectorized operations are truly beautiful. --- Jeff Newmiller The . .

[R] Simulating distribution of max of two die

2011-08-29 Thread Jaap van Wyk
Hallo I am teaching a very elementary intro course about R, and want to show the students how to find the distribution of the maximum of rolling two balanced die. Is there perhaps a more elegant way to do this, other than the way I am using below? (I would like to show them two ways - the