On Sun, Feb 2, 2014 at 2:09 PM, David Parkhurst <parkh...@imap.iu.edu>wrote:

> I've tried to figure out how to do this from what I read, but haven't been
> successful.  Suppose I have a dataframe with variables Date, X, and Y (and
> maybe U, V, and Z) where X, Y, etc. have different units.  I'd like to plot
> Y vs. Time above X vs. Time, above one another.
>
> For example, X is the number of gulls counted on a reservoir, and Y is the
> number of coliform bacteria counted on a petri plate from a water sample
> leaving the reservoir, so these have very different ranges. U and V might
> be numbers of geese and numbers of ducks counted on the same days.
>
> What commands would I use to create such a set of plots?
> Thank you for any help.
> David
>
>
library(zoo)
dd <- as.Date(c("2000-01-01", "2001-01-01", "2002-01-01"))
X <- 1:3
Y <- 4:6
Z <- 7:9
U <- 10:12

z <- zoo(cbind(X, Y, Z, U), dd)
plot(z)

library(lattice)
xyplot(z)

library(ggplot2)
autoplot(z) + facet_free()


-- 
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com

        [[alternative HTML version deleted]]

______________________________________________
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.

Reply via email to