Re: [R] Specifying Start/End Dates for X-axis Range in plot()/xyplot() [RESOLVED]
On Wed, 21 Sep 2011, Rich Shepard wrote: 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? Got it: extract the window for the times of interest, then plot that window. Rich __ 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.
Re: [R] Specifying Start/End Dates for X-axis Range in plot()/xyplot()
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'] David, 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? Rich __ 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.
Re: [R] Specifying Start/End Dates for X-axis Range in plot()/xyplot()
On Sep 20, 2011, at 7:15 PM, Rich Shepard wrote: I'm having difficulty finding the syntax to use to specify the beginning and ending dates for the x-axis while plotting a zoo object. I thought that I had seen a message on this list that used start=as.Date("...") end=as.Date("..."), but I cannot find that message. I've tried ?plot, ?plotxy, ?plot.zoo, and Sarkar's lattice book. I am trying to plot the time series for 'Burns Mg' generated by: sapply(names(z), function(nm) range(time(na.omit(z[, nm]))), simplify = FALSE) $`Burns Mg`[1] "1994-01-20" "2009-11-11" This is a typical result of my trial-and-error approach: plot(z[, $'Burns Mg'], range(time(start = as.Date("1994-01-20"), end = as.Date("2009-11-11" Error in is.matrix(x) : 'x' is missing Please point me to documentation on specifying 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'] For better guessing, supply the output of: dput(z) # We have no idea what 'Burns Mg' has in it. Or just use an example from the zoo pages. Also: wrapping range() around a vector formed from two elements seems at the very best unnecessary and at the worst positively fraught with downside potential. And the 'time' function does not have arguments names start and stop. -- David TIA, Rich __ 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. David Winsemius, MD West Hartford, CT __ 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.
[R] Specifying Start/End Dates for X-axis Range in plot()/xyplot()
I'm having difficulty finding the syntax to use to specify the beginning and ending dates for the x-axis while plotting a zoo object. I thought that I had seen a message on this list that used start=as.Date("...") end=as.Date("..."), but I cannot find that message. I've tried ?plot, ?plotxy, ?plot.zoo, and Sarkar's lattice book. I am trying to plot the time series for 'Burns Mg' generated by: sapply(names(z), function(nm) range(time(na.omit(z[, nm]))), simplify = FALSE) $`Burns Mg`[1] "1994-01-20" "2009-11-11" This is a typical result of my trial-and-error approach: plot(z[, $'Burns Mg'], range(time(start = as.Date("1994-01-20"), end = as.Date("2009-11-11" Error in is.matrix(x) : 'x' is missing Please point me to documentation on specifying TIA, Rich __ 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.