Add this after the zm<- statement colnames(zm) <- sapply(z.l, colnames)
On Mon, Sep 8, 2008 at 12:09 PM, stephen sefick <[EMAIL PROTECTED]> wrote: > I have one more question. The below example is revised to better > reflect the problem that I am running into. The two columns for each > data frame in the list are named the same because they are subsets of > the same site, which has the same name in the larger data set. So > when xyplot plots the merged list it labels each plot with a > structure(...) see the plot in the example below. I need to have the > labels from each column (Temp and DO) show up on each one of there > corresponding plots. I am using this to scan the data for "bad" > dissovled oxygen signals so that I can throw out erroneous readings > before the calculation of Primary Productivity. Thanks in advance. > If this is not clear I will try and explain better. > > #here is a made up example > library(chron) > library(zoo) > t1 <- chron("1/1/2006", "00:01:00") > t2 <- chron("1/1/2006", "23:46:00") > deltat <- times("00:15:00") > tt <- seq(t1, t2, by = times("00:15:00")) > DO <- rnorm(96) > Temp <- rnorm(96) > a <- cbind(Temp, DO) > > > t3 <- chron("12/1/2006", "00:01:00") > t4 <- chron("12/1/2006", "23:46:00") > deltat <- times("00:15:00") > tt.2 <- seq(t3, t4, by = times("00:15:00")) > DO <- rnorm(96) > Temp<- rnorm(96) > b <- cbind(Temp, DO) > > t5 <- chron("5/1/2006", "00:01:00") > t6 <- chron("6/1/2006", "23:46:00") > deltat <- times("00:15:00") > tt.3 <- seq(t5, t6, by = times("00:15:00")) > DO <- rnorm(96) > Temp<- rnorm(96) > g <- cbind(Temp, DO) > > z1 <- zoo(a, tt) > z2 <- zoo(b, tt.2) > z3 <- zoo(g, tt.3) > > z.l <- list(z1,z2,z3) > > zm <- do.call(merge, z.l) > xlim <- lapply(zm, function(x) range(time(na.omit(x)))) > xyplot(zm, xlim = xlim, scale = list(relation = "free")) > > On Sat, Sep 6, 2008 at 9:17 PM, Gabor Grothendieck > <[EMAIL PROTECTED]> wrote: >> Try xyplot.zoo with scale = list(relation = "free") >> specifying xlim as shown below: >> >> library(zoo) >> library(lattice) >> zm <- do.call(merge, z.l) >> xlim <- lapply(zm, function(x) range(time(na.omit(x)))) >> xyplot(zm, xlim = xlim, scale = list(relation = "free")) >> >> On Sat, Sep 6, 2008 at 7:49 PM, stephen sefick <[EMAIL PROTECTED]> wrote: >>> the plot(do.call(merge, z.l)) works on the following data well. Is >>> there a way to get control of xlim so that it plots each individual >>> graph shows only the one day (figures the x axis on the range of the >>> data for each plot individually) and control labeling? Thanks in >>> advance, and sorry for not putting an example in the first email. >>> >>> #here is a made up example >>> library(chron) >>> library(zoo) >>> t1 <- chron("1/1/2006", "00:01:00") >>> t2 <- chron("1/1/2006", "23:46:00") >>> deltat <- times("00:15:00") >>> tt <- seq(t1, t2, by = times("00:15:00")) >>> DO <- rnorm(96) >>> Temp <- rnorm(96) >>> a <- cbind(Temp, DO) >>> >>> >>> t3 <- chron("12/1/2006", "00:01:00") >>> t4 <- chron("12/1/2006", "23:46:00") >>> deltat <- times("00:15:00") >>> tt.2 <- seq(t3, t4, by = times("00:15:00")) >>> DO.2 <- rnorm(96) >>> Temp.2<- rnorm(96) >>> b <- cbind(Temp.2, DO.2) >>> >>> z1 <- zoo(a, tt) >>> z2 <- zoo(b, tt.2) >>> >>> z.l <- list(z1,z2) >>> plot(do.call(merge, z.l)) >>> >>> On Sat, Sep 6, 2008 at 7:22 PM, Gabor Grothendieck >>> <[EMAIL PROTECTED]> wrote: >>>> Please read the last line to every message to r-help. In particular >>>> this question needs to include a cut down version of the data. >>>> >>>> I'll take a guess at what it looks like: >>>> >>>> library(zoo) >>>> L <- list(a = zoo(1:3), b = zoo(4:5)) >>>> plot(do.call(merge, L)) >>>> >>>> >>>> On Sat, Sep 6, 2008 at 4:47 PM, stephen sefick <[EMAIL PROTECTED]> wrote: >>>>> i have a list of 6 each containing a dataframe of 96 observations as a >>>>> zoo object. Is there a way to plot these in one frame >>>>> par(mfrow=c(3,2)) >>>>> >>>>> this is what I tried >>>>> lapply(d, FUN=plot) >>>>> >>>>> I can provide data, list is large. >>>>> thanks >>>>> >>>>> -- >>>>> Stephen Sefick >>>>> Research Scientist >>>>> Southeastern Natural Sciences Academy >>>>> >>>>> Let's not spend our time and resources thinking about things that are >>>>> so little or so large that all they really do for us is puff us up and >>>>> make us feel like gods. We are mammals, and have not exhausted the >>>>> annoying little problems of being mammals. >>>>> >>>>> -K. Mullis >>>>> >>>>> ______________________________________________ >>>>> 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. >>>>> >>>> >>> >>> >>> >>> -- >>> Stephen Sefick >>> Research Scientist >>> Southeastern Natural Sciences Academy >>> >>> Let's not spend our time and resources thinking about things that are >>> so little or so large that all they really do for us is puff us up and >>> make us feel like gods. We are mammals, and have not exhausted the >>> annoying little problems of being mammals. >>> >>> -K. Mullis >>> >> > > > > -- > Stephen Sefick > Research Scientist > Southeastern Natural Sciences Academy > > Let's not spend our time and resources thinking about things that are > so little or so large that all they really do for us is puff us up and > make us feel like gods. We are mammals, and have not exhausted the > annoying little problems of being mammals. > > -K. Mullis > ______________________________________________ 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.