[R] ifelse command

Greg Snow Greg.Snow at imail.org
Thu Aug 19 18:27:39 CEST 2010


It would help us help you if you could give a description of what your ultimate goal is here.  Is it to simulate the dice?  Then you may want to just use the dice function in the TeachingDemos package (or you can animate the rolling with plot.rgl.die and roll.rgl.die in the same package).  Or is it to understand more use of the sample function?  Your original post did the correct thing with sample, but then immediately threw away the results without using them.  Is it to better understand random number generation?  Better understand putting values into categories? Use cut or findInterval (or others).

The more you help us understand your goals, the better we can help you. 

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
801.408.8111


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Philip Wong
> Sent: Wednesday, August 18, 2010 8:46 PM
> To: r-help at r-project.org
> Subject: Re: [R] ifelse command
> 
> 
> well to be honest, it is a assignment for the Bayesian statistic paper
> I wish
> to take later in the academic year.  But I'm a slow learner, so I'm
> going to
> try out some of the assignments posted in the university forum hoping
> to get
> some practice in advance.
> 
> Could you please elaborate more on the set.seed() function, I
> understood
> from the ?set.seed the general idea of set.seed (if I didn't
> misunderstood
> it).  I could stimulate a six side dice by set.seed(1:6) with n number
> of
> runs using runif(), does that meant if I use set.seed() I don't need to
> use
> the prob=c(1,1,2,3,2,1)/10) to create my bias dice?
> --
> View this message in context: http://r.789695.n4.nabble.com/ifelse-
> command-tp2329538p2330591.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list