Re: [R] if else statement

From: Petr Pikal <petr.pikal_at_precheza.cz>
Date: Fri 19 Jan 2007 - 13:39:53 GMT


Hi

also note the difference between if and ifelse. The former is similar to other languages

if (true or false codition) {do this} else {do that}

but

ifelse(logical vector, vector for true elements, vector for false elements)

see corespondent help pages.

HTH
Petr

On 18 Jan 2007 at 19:02, H. Paul Benton wrote:

Date sent:      	Thu, 18 Jan 2007 19:02:49 -0800
From:           	"H. Paul Benton" <hpbenton@scripps.edu>
To:             	r-help@stat.math.ethz.ch
Subject:        	[R] if else statement

> Hello,
>
> I'm doing some scripting and I've noticed that R doesn't seem to
> have an if (cond){
> do
> }ifelse (cond) {
> do
> } else {
> do
> }
>
> type block.
>
> Is this correct or am I missing something.
>
> THX
>
> Paul
>
> --
> Research Technician
> Mass Spectrometry
> o The
> /
> o Scripps
> \
> o Research
> /
> o Institute
>
> ______________________________________________
> 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 and provide commented,
> minimal, self-contained, reproducible code.

Petr Pikal
petr.pikal@precheza.cz



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 and provide commented, minimal, self-contained, reproducible code. Received on Sat Jan 20 01:13:49 2007

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Fri 19 Jan 2007 - 15:30:28 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.