[R] if else lop

2011-07-05 Thread gary engstrom
I am trying to use if...else loop and have included a code snippet which I might like to expand. Maybe you could steer me in the right direction. library(stats) library(prob) { a - sample ( 1:4,100, replace=T,prob=c(0.1,0.2,0.5,0.3))

Re: [R] if else lop

2011-07-05 Thread Sarah Goslee
Gary, Was the second half of my message this morning not clear enough? It wasn't clear from your original message that you were using isin() from the prob package, rather than using isin() as pseudocode, so I'd written a function to do that part. But the second half of my message went through

Re: [R] if else lop

2011-07-05 Thread peter dalgaard
On Jul 5, 2011, at 22:27 , gary engstrom wrote: I am trying to use if...else loop Argh! hurting of eyes and gnashing of teeth A loop goes _around_ and around. for, repeat, while. if ... else is a _branching_ construct. -- Peter Dalgaard Center for Statistics, Copenhagen Business School

Re: [R] if else lop

2011-07-05 Thread Joshua Wiley
On Tue, Jul 5, 2011 at 2:53 PM, peter dalgaard pda...@gmail.com wrote: On Jul 5, 2011, at 22:27 , gary engstrom wrote: I am trying to use if...else loop Argh! hurting of eyes and gnashing of teeth A loop goes _around_ and around. for, repeat, while. if ... else  is a _branching_

Re: [R] if else lop

2011-07-05 Thread Bert Gunter
Hi Peter: Beware that gnashing of teeth business. My Dad, a dentist, said that a couple of his patients who were musicians did this when they played and ground their teeth down so much he had to make them dentures! ;-) Cheers, Bert On Tue, Jul 5, 2011 at 2:53 PM, peter dalgaard