On Mon, Sep 19, 2011 at 5:24 PM, Rich Shepard <rshep...@appl-ecosys.com> wrote: > On Mon, 19 Sep 2011, Rich Shepard wrote: > >> On a related note, I'm reading the zoo help pages and vignettes but do >> not see the syntax for specifying which stream/parameter pair I want to >> plot. What do I read to learn how to do this? > > I think that my reading answered this question, but now I need to refine > the plots. > > If I run 'plot(z[, 1])' for example I get the stream/parameter pair in > that is on the left of the top row. This leads to two refinement questions: > > 1) How can I get a list of the stream/parameter pairs and their position > in the summary matrix? and,
names(z) gives the column names of zoo object z. If the third column is named SO then z[, 3], z[, "SO"] or z$SO will give that single column. > > 2) How can I determine the earliest and latest dates in each > stream/parameter pair in which there are data? According to the zoo.quickref > vignette, start and end provide the earliest and last dates in the index, > not necessarily for a specific stream/paramater pair. Once I have those > dates I can specify start = as.Date("<start-date>") and end = > as.Date("<end-date>") library(zoo) # test data z <- zoo(cbind(a = c(NA, 1:3, NA), b = c(NA, NA, 1:3)), Sys.Date() + 1:5) # get a list of date ranges lapply(1:ncol(z), function(i) range(time(na.omit(z[, i])))) which gives: [[1]] [1] "2011-09-21" "2011-09-23" [[2]] [1] "2011-09-22" "2011-09-24" -- Statistics & Software Consulting GKX Group, GKX Associates Inc. tel: 1-877-GKX-GROUP email: ggrothendieck at gmail.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.