[R] several "ifelse" problems...

Berwin A Turlach berwin at maths.uwa.edu.au
Sat Feb 14 06:35:26 CET 2009


Dear Kathie,

On Fri, 13 Feb 2009 21:08:25 -0800 (PST)
kathie <kathryn.lord2000 at gmail.com> wrote:

> Dear R users,
> [snip]
> 
> However, even though the results show that y=8 for x=0.11, when
> x=0.11, actual y value is -0.9.  And, y=-0.8 for x=0.88.  I cannot
> understand the above results.

It may help you to understand those results when you look at the
difference between
 	0.1 < x & x < 0.2
and
	0.1 < x && x < 0.2

Your code used the latter but I strongly suspect you wanted the former.

HTH.

Best wishes,

	Berwin

=========================== Full address =============================
Berwin A Turlach                            Tel.: +65 6516 4416 (secr)
Dept of Statistics and Applied Probability        +65 6516 6650 (self)
Faculty of Science                          FAX : +65 6872 3919       
National University of Singapore     
6 Science Drive 2, Blk S16, Level 7          e-mail: statba at nus.edu.sg
Singapore 117546                    http://www.stat.nus.edu.sg/~statba




More information about the R-help mailing list