When I produce a ggseasonplot using the forecast package using the following data..
tsdata<- structure(c(5515, 5208, 5870, 5553, 5578, 5486, 5141, 5402, 5176,
4746, 5401, 5749, 5892, 5994, 6334, 6119, 5891, 6148, 5927,
5994,5633, 5150, 5937, 6152, 6619, 6391, 6733, 6454, 6236,
6222, 5959, 6265, 6239, 5829, 6335), .Dim = c(35L, 1L), .Dimnames = list(NULL, "Count"), .Tsp = c(2016.33333333333, 2019.16666666667,
12), class = "ts")
using this code:
forecast::ggseasonplot(tsdata)
The data plots incorrectly - the plotted values aren't correct, Jan 2019 is missing and there are 2 values for Jan 17??
If I plot the identical data using:
forecast::seasonplot(tsdata)
... everything is plotted correctly - I'm baffled - can anyone help with what I'm doing wrong?
(forgive me as I'm relatively new to R and very new to Stack Overflow!)
G
There's a floating point issue in the 9th value, which makes it a fraction of a millisecond before 2017:
> options(digits = 16)
> time(tsdata)[9]
[1] 2016.999999999998
I don't know ts
well enough to understand how to avoid creating a value like this, but one hack would be to add a fraction of a second to each value...