[R] Specifying Start/End Dates for X-axis Range in plot()/xyplot()

Rich Shepard rshepard at appl-ecosys.com
Wed Sep 21 18:32:20 CEST 2011

On Tue, 20 Sep 2011, David Winsemius wrote:

> It seems likely even if you got past that error, you would encounter problems 
> from the hashed up syntax in this portion of that plot call:
> z[, $'Burns Mg']


   Yes, that's not close to correct.

   If I specify
 	plot(z[, "Burns Mg"])  # returned by names(z)
I see the plot with the x-axis range from the earliest date for any data
("1980-01-01") to the latest date for any data ("2011-06-09"). What I'm
trying to learn is how to specify start and end dates for each of the z
names. I have these dates as a list returned by:
 	lapply(1:ncol(z), function(i) range(time(na.omit(z[, i]))))

   What I thought might wark was
 	plot(z[, "Burns Mg"], start = as.Date("1994-01-20"), end = 
as.Date("2009-11-11"))  # wrapped in alpine; a single line in emacs

but this generates warnings and no plots.

   In the zoo-quickref vignette are examples of querying dates (bottom of
page 1) and selecting a range of dates of interest (page 5, using the
window() function), but I cannot extrapolat from these examples to to plot a
specified stream/param pair only within explicit start and end dates.

   Is there documentation I can read that will teach me the proper syntax?
Or, can you show me how to specify those dates when plotting z elements?


More information about the R-help mailing list