Use & instead of && --Ista
On Sep 9, 2016 8:12 AM, "Matti Viljamaa" <mvilja...@kapsi.fi> wrote: > I’m getting strange behaviour when trying to extract rows from a > two-column data.frame with double values. > > My data looks like: > > mom_iq kid_score > 1 121.11750 65 > 2 89.36188 98 > 3 115.44320 85 > 4 99.44964 83 > … > > and I’m testing extracting rows that have mom_iq at some interval, so e.g. > > kidmomiq[kidmomiq$mom_iq > 80.0 && kidmomiq$mom_iq < 130.0,] > > correctly returns rows that have mom_iq \in ]80.0, 130.0[. > > However, if I adjust this to: > > kidmomiq[kidmomiq$mom_iq > 80.0 && kidmomiq$mom_iq < 120.0,] > > (and there are clearly values that also fall \in ]80.0, 120.0[ !) > > I get: > > [1] mom_iq kid_score > <0 rows> (or 0-length row.names) > > Why does the extraction fail on some values, but not some others? > ______________________________________________ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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. [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.