Skip to content
Prev 378823 / 398502 Next

strucchange Graph By Week and xts error

Thanks to Achim's direction I now have a re-producible example.

The code below creates a ts object.  The x scale of the last graph runs from 0 to 700.

So just need a way to get that scale to show the weeks (or some summary of them).

Thanks a bunch.
--JJS


library(strucchange)
library(xts)
library(lubridate)

#rm(list=ls())


data("Nile")
class(Nile)
plot(Nile)
bp.nile <- breakpoints(Nile ~ 1)
ci.nile <- confint(bp.nile, breaks = 1)
lines(ci.nile)


dfNile<-data.frame(as.numeric(Nile))
dfNile$week<-seq(ymd('2012-01-01'),ymd('2013-11-30'),by='weeks')
tsNile <- as.xts(x = dfNile[, -2], order.by = dfNile$week)
tsNile<-as.ts(tsNile)


plot(tsNile)
bp.tsNile <- breakpoints(tsNile ~ 1)
ci.tsNile <- confint(bp.tsNile, breaks = 1)
lines(ci.tsNile)