[R] Switching Axis in Time Series plotting
Peter Ehlers
ehlers at ucalgary.ca
Fri Feb 12 13:36:43 CET 2010
Assuming that you are using the xts package, try this:
data(sample_matrix)
sample.xts <- as.xts(sample_matrix)
open <- as.vector(sample.xts[,1])
month <- as.Date(time(sample.xts))
plot(open, month, type="l")
-Peter Ehlers
JSmaga wrote:
> Basically it works, but I use the xts format and the axis are messed up.
>
> plot(c(time(ser)) ~ c(ser), type = "l")
> Error in as.POSIXct.default(x) :
> do not know how to convert 'x' to class "POSIXlt"
>
> I don't know why do you have any idea?
>
> Besides, why do you use the c(...) function in your code ?
>
> And finally, i am not used to the ~ operator and the R doc did not help me,
> could you tell me what it does?
>
> Sorry for all the questions...
>
> Jeremie
More information about the R-help
mailing list