0

Problem in R: I am trying to transform my data into a form, from which I can do the basic time series analysis. The date function's class is defined with the following code.

df$Date <- as.POSIXct(df$Date1, format ="%Y-%m-%d %H:%M:%S")

This data frame is then converted into a time series object with the following code:

timeseries <- xts(df$V1, df$Date)

However, when I try to use the decompose command

dec <- decompose(timeseries)

I get an error message that states

"Error in decompose(timeseries) : time series has no or less than 2 periods"

So, how can I transform my data into the right class so that I can perform the function (decompose).

Here is a photo of the original data frame. enter image description here

Nad Pat
  • 2,995
  • 3
  • 9
  • 19
Jrayman
  • 37
  • 3
  • which packages are you using? Don't use a photo / image of your data, but use dput. Read this to make a decent [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) – phiver Nov 15 '21 at 09:38

0 Answers0