Message-ID: <CAM_vjukP9v05z77x=-S0wYWD3cfw0iGp7tgMTj6pSR6kenbH6Q@mail.gmail.com>
Date: 2013-11-07T15:16:33Z
From: Sarah Goslee
Subject: strange behaviour when subsetting a data.frame
In-Reply-To: <8143A255DE0826499FB1C7CD935FF6930616B9E4@msxmb01.msx.tu-dresden.de>
R FAQ 7.31.
http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-doesn_0027t-R-think-these-numbers-are-equal_003f
On Thu, Nov 7, 2013 at 8:36 AM, Eckst?dt, Elisabeth
<elisabeth.eckstaedt at tu-dresden.de> wrote:
> Hello everyone,
> I am experiencing a unfathomable benaviour of "subset" on a data.frame. This is a minimal reproducable example. The data.frame cosists only of one column, which contains 10 ascending values (from 0.1 to 1). Subsetting for 0.1 is working (gives me one row), subsetting for 0.3 gives me zero rows? Doing the same with values from 1 to 10 is working out well (as expected).
>
> Beimischung=seq(0.1,1,0.1)
> man2=data.frame(Beimischung)
> subset(man2, Beimischung==0.3)
> #---> gives 0 rows
> subset(man2, Beimischung==0.1)
> ---> gives one row (as expected)#
>
> #also not working:
>
> man2$Beimischung3=man2$Beimischung*10
> subset(man2, Beimischung3==3)
> --> gives 0 rows
>
> Does anybody have a clue for me?
> Thanks in advance
> Regards
> Elisabeth