Re: [R] match() seq()

2006-01-31 Thread Petr Pikal
wrote: Date sent: Tue, 31 Jan 2006 11:21:20 +0400 From: Jacques VESLOT [EMAIL PROTECTED] To: [EMAIL PROTECTED] Copies to: R-help@stat.math.ethz.ch Subject:Re: [R] match() seq() Thanks Roger, Andy and Dimitris

[R] match() seq()

2006-01-30 Thread Jacques VESLOT
sorry if it has already been discussed but i can't understand this: seq(0.1,1,by=0.1) [1] 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 match(0.1,seq(0.1,1,by=0.1)) [1] 1 match(0.2,seq(0.1,1,by=0.1)) [1] 2 match(0.3,seq(0.1,1,by=0.1)) [1] NA match(0.4,seq(0.1,1,by=0.1)) [1] 4 R.version

Re: [R] match() seq()

2006-01-30 Thread Liaw, Andy
Hope this is clear: x - seq(0.1, 1, by=0.1) 0.3 == x[3] [1] FALSE abs(0.3 - x[3]) [1] 5.551115e-17 Andy From: Jacques VESLOT sorry if it has already been discussed but i can't understand this: seq(0.1,1,by=0.1) [1] 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0

Re: [R] match() seq()

2006-01-30 Thread Dimitris Rizopoulos
3:19 PM Subject: [R] match() seq() sorry if it has already been discussed but i can't understand this: seq(0.1,1,by=0.1) [1] 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 match(0.1,seq(0.1,1,by=0.1)) [1] 1 match(0.2,seq(0.1,1,by=0.1)) [1] 2 match(0.3,seq(0.1,1,by=0.1)) [1] NA match(0.4

Re: [R] match() seq()

2006-01-30 Thread Roger Bivand
On Mon, 30 Jan 2006, Jacques VESLOT wrote: sorry if it has already been discussed but i can't understand this: seq(0.1,1,by=0.1) [1] 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 match(0.1,seq(0.1,1,by=0.1)) [1] 1 match(0.2,seq(0.1,1,by=0.1)) [1] 2 match(0.3,seq(0.1,1,by=0.1)) [1]

Re: [R] match() seq()

2006-01-30 Thread Jacques VESLOT
Thanks Roger, Andy and Dimitris... though i am familiar with this behaviour **in some cases**, i couldn't catch - yesterday evening - why it matched with 0.4, and not with 0.3; of course these numbers are not integers ! but i believed match() deals with such equalities. i will have a look at