FAQ Q7.31 On Tue, 20 Feb 2007, Todd A. Johnson wrote:
> Hi All- > > This seems like such a pathetic problem to be posting about, but I have no > idea why this testcase does not work. I have tried this using R 2.4.1, > 2.4.0, 2.3.0, and 2.0.0 on several different computers (Mac OS 10.4.8, > Windows XP, Linux). Below the signature, you will find my test case R code. > > My point in this folly is to take a dataframe of 300,000 rows, create a > filter based on two of the rows, and count the number of rows in the > filtered and unfiltered dataframe. One column in the filter only has the > numbers 0.05, 0.15, 0.25, 0.35, 0.45, 0.55, 0.65, 0.75, 0.85, 0.95, so I > thought that I could just iterate in a for loop and get the job done. Just > the simple single column filter case is presented here. Obviously, there are > only ten numbers, so the "manual" method is easy, but I would like to have a > more flexible program. (Plus it worries me if the simple things don't do > what I expect... :-) ) > >> From the output, you can see that the loop using the "handmadevector" that > creates a filter and counts the elements, correctly finds one match for each > element in the vector, but the seq() and for loop produced vectors each give > a mixture of true and false matches. > > Can anyone tell me why the "loopvector" and "seqvector" do not provide the > same output as the "handmadevector". > > > Thank you for your assistance! > > Todd > > -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595 ______________________________________________ R-help@stat.math.ethz.ch 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.