Applying yearwise segmented regression in R
问题 I have daily rainfall data which I have converted to yearwise cumulative value using following code library(seas) library(data.table) library(ggplot2) #Loading data data(mscdata) dat <- (mksub(mscdata, id=1108447)) dat$julian.date <- as.numeric(format(dat$date, "%j")) DT <- data.table(dat) DT[, Cum.Sum := cumsum(rain), by=list(year)] df <- cbind.data.frame(day=dat$julian.date,cumulative=DT$Cum.Sum) Then I want to apply segmented regression year-wise to have year-wise breakpoints. I could able