[R] diff question

2015-01-11 Thread Troels Ring
R version 3.1.1 (2014-07-10) -- Sock it to Me Copyright (C) 2014 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 (64-bit) Dear friends - I have a small problem with diff (I guess) I made a sequence with fixed interval between consecutive elements - and hence thought

Re: [R] diff question

2015-01-11 Thread Rolf Turner
See FAQ 7.31. cheers, Rolf Turner On 11/01/15 21:29, Troels Ring wrote: R version 3.1.1 (2014-07-10) -- Sock it to Me Copyright (C) 2014 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 (64-bit) Dear friends - I have a small problem with diff (I guess) I made a

Re: [R] diff question

2015-01-11 Thread Ted Harding
Troels, this is due to the usual tiny difference between numbers as computed by R and the numbers that you think they are! tt - seq(0,20,by=0.02) dtt - diff(tt) length(dtt) # [1] 1000 r02 - rep(0.02,1000) unique(r02 - dtt) # [1] 0.00e+00 3.469447e-18 -3.469447e-18

Re: [R] diff question

2015-01-11 Thread Ted Harding
I should have added an extra line to the code below, to complete the picture. Here it is (see below line ##. Ted. On 11-Jan-2015 08:48:06 Ted Harding wrote: Troels, this is due to the usual tiny difference between numbers as computed by R and the numbers that you think they are! tt