Let's assume I have a vector
library(ggplot2)
df <- data.frame(Tjump = c(0.2260760,0.2628534,0.4053514,0.2938391,0.5940260),
State = c(9,10,9,8,7))
wherein Tjump is the elapsed time after which the next state transition occurs. df can be plotted as a step function by
qplot(cumsum(df$Tjump), df$State, geom = "step")
How can I now plot this step function together with another function that runs over times <- seq(from = 0, to = tail(df$Time, 1), by = 0.01)?
Or, to approach it differently: how can I expand df to have the same amount of entries as times by preserving it's step nature?