Dear list, I'm trying to do a loop where I should choose a cell of a data frame comparing it with another. The code actually works for the majority of the loop but for some reason it doesn't and I can't figure out why. When I tried to understand why I've noticed this:> dif[11][1] 118.8333> linhasUpdate[10,6][1] 118.8333> dif[11]==linhasUpdate[10,6][1] FALSE Even though the values are the same R says they aren't! This happens for some of the values (44) and for the others (128) it works fine. Does anybody why is this happening or a way to fix it? I' using 2.15.0. Thanks a lot! Andreia Leite -- View this message in context: http://r.789695.n4.nabble.com/equality-of-values-tp4634351.html Sent from the R help mailing list archive at Nabble.com.
Sigh.... R Faq 7.31. ?options ## The "digits" option. Also ?print.default ## and digits option -- Bert On Sun, Jun 24, 2012 at 10:58 AM, Andreia Leite < andreiaheitorleite@gmail.com> wrote:> Dear list, > > I'm trying to do a loop where I should choose a cell of a data frame > comparing it with another. The code actually works for the majority of the > loop but for some reason it doesn't and I can't figure out why. > > When I tried to understand why I've noticed this: > > > dif[11] > [1] 118.8333 > > linhasUpdate[10,6] > [1] 118.8333 > > dif[11]==linhasUpdate[10,6] > [1] FALSE > > Even though the values are the same R says they aren't! This happens for > some of the values (44) and for the others (128) it works fine. > > Does anybody why is this happening or a way to fix it? I' using 2.15.0. > > Thanks a lot! > > Andreia Leite > > -- > View this message in context: > http://r.789695.n4.nabble.com/equality-of-values-tp4634351.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >-- Bert Gunter Genentech Nonclinical Biostatistics Internal Contact Info: Phone: 467-7374 Website: http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm [[alternative HTML version deleted]]
Please read R FAQ 7.31, Why doesn't R think these numbers are equal? Sarah On Sun, Jun 24, 2012 at 1:58 PM, Andreia Leite <andreiaheitorleite at gmail.com> wrote:> Dear list, > > I'm trying to do a loop where I should choose a cell of a data frame > comparing it with another. The code actually works for the majority of the > loop but for some reason it doesn't and I can't figure out why. > > When I tried to understand why I've noticed this: > >> dif[11] > [1] 118.8333 >> linhasUpdate[10,6] > [1] 118.8333 >> dif[11]==linhasUpdate[10,6] > [1] FALSE > > Even though the values are the same R says they aren't! This happens for > some of the values (44) and for the others (128) it works fine. > > Does anybody why is this happening or a way to fix it? I' using 2.15.0. > > Thanks a lot! > > Andreia Leite > > ---- Sarah Goslee http://www.functionaldiversity.org