I have a time series with multiple days of data. In between each day there\'s one period with no data points. How can I omit these periods when plotting the time series usin
The problem is that how does ggplot2 know you have missing values? I see two options:
NA valuesAdd an additional variable representing a "group". For example,
dd = data.frame(Time, Value)
##type contains three distinct values
dd$type = factor(cumsum(c(0, as.numeric(diff(dd$Time) - 1))))
##Plot, but use the group aesthetic
ggplot(dd, aes(x=Time, y=Value)) +
geom_line (aes(group=type))
gives
