Larry White wrote: > Sorry - this must be obvious, but i haven't been able to find the > answer in the guides i've searched. The examples seem to assume you > always want to look at all the data. > > I want to be able to filter data in a dataframe before analyzing it. > For example, I'd like to plot(a,b) but only include values where b > > 1000. > > I'd also like to be able to do similar filtering before doing other > statistical functions.
In addition to what Paul Hiemstra mentioned, you should look at the help page for subset(). For example: df <- data.frame(a = runif(20), b = 1:20) plot(a ~ b, data = subset(df, b > 5)) > Thanks for your help. > > ______________________________________________ > [email protected] 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. -- Chuck Cleland, Ph.D. NDRI, Inc. 71 West 23rd Street, 8th floor New York, NY 10010 tel: (212) 845-4495 (Tu, Th) tel: (732) 512-0171 (M, W, F) fax: (917) 438-0894 ______________________________________________ [email protected] 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.
