0

The problem is that when i run ts(), the dates (Mean_Individual_data$Date) which are in posixct format gets converted to integers as shown in the graph via the link below. Are there any ways to preserve date-time format for the x-axis after passing it through ts()?

I have been trying out many methods but can't seem to find a solution to this. So any help or alternative solutions are greatly appreciated.

Data: https://www.dropbox.com/s/9lf2nc74y67uscd/Mean_Individual_data.csv?dl=0

Mean_Individual_data
         Date_Timeframe         x
1   2098-02-09 09:00:00 20.000000
2   2098-02-10 09:00:00 24.100000
3   2098-02-11 09:00:00 27.900000
4   2098-02-12 09:00:00 28.400000
5   2098-02-12 15:00:00 24.450000
6   2098-02-12 21:00:00 15.800000
7   2098-02-13 09:00:00 16.450000
8   2098-02-13 21:00:00 15.050000
9   2098-02-14 03:00:00 22.700000
10  2098-02-14 09:00:00 14.200000

MA_Individual = ts(Mean_Individual_data$Mean.Result.Value, frequency=60)
fit<-auto.arima(MA_Individual, seasonal=TRUE)
fcast <- forecast(fit, h=20)
plot(fcast, type="o", pch=16, cex=0.65, xlab="Date", ylab="Blood Glucose (mmol/L)", main = "Quart-Hourly BG")
abline(h=4, col="red", lty=2)

The resulting plot:

enter image description here

Lacri Mosa
  • 159
  • 1
  • 10
  • 1
    Welcome to SO. Please provide a reproducible example. This will give people who want to help you something to work with and to test. You can read about it **[here](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example)**. – KoenV Mar 12 '18 at 17:03
  • ts is not normally used with POSIXct. Use zoo or xts instead. – G. Grothendieck Mar 12 '18 at 17:05
  • My apologies. I couldnt publish the full data due to some data confidentiality with the research facility but I have added a dropbox link above for the cleaned up csv file. – Lacri Mosa Mar 13 '18 at 02:09

0 Answers0