Hello, All,

Mac OS 10.6.5
R64 2.11.1

This works as expected:

f1 = c(0.084, 0.099, 0)
data= data.frame(f1)
data$f1=with(data,ifelse(f1==0, 0.0001, f1))
data

     f1
1 0.0840
2 0.0990
3 0.0001

Substituting 'f1==0' with 'T' produces the expected result:

f1 = c(0.084, 0.099, 0)
data= data.frame(f1)
data$f1=with(data,ifelse(T, 0.0001, f1))
data

     f1
1 1e-04
2 1e-04
3 1e-04

But, substituting 'f1==0'  or 'T' with 'F' does not produce the expected result:

f1 = c(0.084, 0.099, 0)
data= data.frame(f1)
data$f1=with(data,ifelse(F, 0.0001, f1))
data

     f1
1 0.084
2 0.084
3 0.084

I would expect this:
     f1
1 0.084
2 0.099
3 0

Is with(data.frame,ifelse(___,___,___)) broken, or does my interpretation of it 
need fixing?

Thank you for your time.

Jim

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to