[R] From data frame to time series matrix and plot [UPDATE]
Rich Shepard
rshepard at appl-ecosys.com
Tue Mar 4 18:05:05 CET 2014
On Mon, 3 Mar 2014, Rich Shepard wrote:
> I would like to plot (separately) time series for the 'disch' and
> 'tempMean' columns but have not had success in passing the correct syntax to
> the plot() function and having the x-axis labels as human-readable dates
> rather than the epoch time (which is what I assume is in the date class).
Significant progress has been made, but I'm still not using the correct
syntax.
1) I modified the original data frame to 3 columns: date, disch, and temp.
2) Using ts() I converted the data frame to a ts object.
3) After reading ?plot.ts and ?ts.plot I determined that the latter is
appropriate for a multivariate time series on a single set of axes:
plot.ts(col.riv.ts, plot.type = "single", xylabels = c("Date","Amount"))
Warning messages:
1: In plot.window(xlim, ylim, log, ...) :
"xylabels" is not a graphical parameter
2: In title(main = main, xlab = xlab, ylab = ylab, ...) :
"xylabels" is not a graphical parameter
3: In axis(1, ...) : "xylabels" is not a graphical parameter
4: In axis(2, ...) : "xylabels" is not a graphical parameter
5: In box(...) : "xylabels" is not a graphical parameter
But, not only have I not correctly specified xylabels, but the dates are
not correctly presented (that is, as dates rather than numbers), and there
are other options which I need to better understand.
Would xyplot() be a better function for these data?
Rich
-------------- next part --------------
A non-text attachment was scrubbed...
Name: col.riv.ts-1.pdf
Type: application/pdf
Size: 13310 bytes
Desc:
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20140304/af040cbd/attachment-0002.pdf>
More information about the R-help
mailing list