Re: [R] Help with IF operator

2011-01-07 Thread Petr Savicky
On Thu, Jan 06, 2011 at 12:21:33PM -0800, ADias wrote: > > Hi, > > I am with a problem on how to do a comparison of values. My script is as > follows: > > repeat{ > cat("How many teams to use? (to end write 0) ") > nro<-scan(n=1) > if(nro==0)break > cat("write the", nro, "teams names \n") > team

Re: [R] Help with IF operator

2011-01-06 Thread Peter Langfelder
Several possibilities: if (length(teams)!=length(unique(teams)) stop("Some teams are duplicated") or if (max(table(teams))>1) stop("Some teams are duplicated") I'm sure there are others, too. On Thu, Jan 6, 2011 at 12:21 PM, ADias wrote: > > Hi, > > I am with a problem on how to do a compar

[R] Help with IF operator

2011-01-06 Thread ADias
Hi, I am with a problem on how to do a comparison of values. My script is as follows: repeat{ cat("How many teams to use? (to end write 0) ") nro<-scan(n=1) if(nro==0)break cat("write the", nro, "teams names \n") teams<-readLines(n=nro) if (teams[1]==teams[2)next else print(teams) } On this ex