[R] why help ignores some values
Sarah Goslee
sarah.goslee at gmail.com
Thu Nov 18 12:27:12 CET 2010
Possibly because R has no idea what the 35.999999999999872-th
element of a matrix is?
However you are coming up with these elements, you are running
into a floating-point arithmetic problem (FAQ 7.31). Using
round() might help.
Sarah
On Thu, Nov 18, 2010 at 6:19 AM, Alaios <alaios at yahoo.com> wrote:
> Please take a look at the values below
> .................
> [31,] 30.000000000000000 30.000000000000000
> [32,] 31.000000000000000 31.000000000000000
> [33,] 32.000000000000000 32.000000000000000
> [34,] 33.000000000000000 33.000000000000000
> [35,] 34.000000000000000 34.000000000000000
> [36,] 35.000000000000000 35.000000000000000
> [37,] 35.999999999999872 35.999999999999872
>
>
> These are entries in an array. These values are used as indexes inside a matrix.
> f[shweights[37,1],shweights[37,2]] works fine for me and returns correctly the value.
>
> but when I try
> f[shweights[,1],shweights[,2]]
> I only get 36 out of 37 results (seems that in that case ignores the last values, 37th)
> .....
> [35,] 2.7245297165175781
> [36,] 2.7245297165175781
>
> Why this might be happening?
> Regards
> Alex
>
>
--
Sarah Goslee
http://www.functionaldiversity.org
More information about the R-help
mailing list