If you use the formula method for plot then you can use the subset argument, for example:
plot(Sepal.Width ~ Sepal.Length, data=iris) plot(Sepal.Width ~ Sepal.Length, data=iris, subset=Species=='setosa') On Mon, Jan 13, 2014 at 5:39 PM, Janet Choate <[email protected]> wrote: > Hi R community, > i have a data frame of streamflow for 23 years, i.e. > > date year month day wy yd wyd modQ > 1 1965-10-01 1965 10 1 1966 274 1 0.3341630 > 2 1965-10-02 1965 10 2 1966 275 2 0.3223247 > 3 1965-10-03 1965 10 3 1966 276 3 0.3109057 > > i only want to plot 1 of the years, along with the date. > i can accomplish this with: > > plot(mod.sage$date[mod.sage$wy==1976],mod.sage$modQ[mod.sage$wy==1976], > type="l") > > however, this is a bit long and clunky. is there a way to plot just a > portion of the full data record without creating a whole new object with > subset? > > thank you for any help! > Janet > > [[alternative HTML version deleted]] > > ______________________________________________ > [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. -- Gregory (Greg) L. Snow Ph.D. [email protected] ______________________________________________ [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.

