Re: [R] the ifelse function

2007-05-06 Thread Peter Dalgaard
Jennifer Dillon wrote:
> Hi Everyone,
>
> I think I found a problem with the ifelse function:  If the condition
> argument is NA, it treats it as true.  Anyone agree or disagree with this?
>
> Jen
I don't see it doing that:

 > ifelse(NA,1,0)
[1] NA

so what do you mean?

__
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.


Re: [R] the ifelse function

2007-05-05 Thread jim holtman
Can you proovide the example you are talking about.  Here is what I got:

> ifelse(NA,1,2)
[1] NA


On 5/5/07, Jennifer Dillon <[EMAIL PROTECTED]> wrote:
> Hi Everyone,
>
> I think I found a problem with the ifelse function:  If the condition
> argument is NA, it treats it as true.  Anyone agree or disagree with this?
>
> Jen
>
> --
> Jennifer Dillon
> Doctoral Student
> Harvard Biostatistics
> Room 414B, Building 1
>
>[[alternative HTML version deleted]]
>
> __
> 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.
>


-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

__
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.


Re: [R] the ifelse function

2007-05-05 Thread Chuck Cleland
Jennifer Dillon wrote:
> Hi Everyone,
> 
> I think I found a problem with the ifelse function:  If the condition
> argument is NA, it treats it as true.  Anyone agree or disagree with this?

  I disagree.

> ifelse(c(5,4,NA) == 5, 1, 0)
[1]  1  0 NA

> Jen

-- 
Chuck Cleland, Ph.D.
NDRI, Inc.
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 512-0171 (M, W, F)
fax: (917) 438-0894

__
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.


[R] the ifelse function

2007-05-05 Thread Jennifer Dillon
Hi Everyone,

I think I found a problem with the ifelse function:  If the condition
argument is NA, it treats it as true.  Anyone agree or disagree with this?

Jen

-- 
Jennifer Dillon
Doctoral Student
Harvard Biostatistics
Room 414B, Building 1

[[alternative HTML version deleted]]

__
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.