Time Series Components


I would like to decompose a time series. It contains of weekly data for 8 years.
I need it to be decomposed so I can look at it without the seasonality or trend but I just started with R and have no idea what to do. I tried it like that:

Data_Components <- decompose(Data)

but if I do so R tells me, that my time series has none or less than two periods.
I loaded the data from an excel file. Maybe I did something wrong there? How do I have to put the data in my excel file so R knows it is an time series with 416 weeks?

Thanks in advance for your help!

This is a nonsense illustration, because the data are sins, but may help with syntax

series <- ts(sin(1:416), frequency = 52)
decomp <- stl(series, s.window = 1)

1 Like

Thanks for your help.
I have some other additional questions now.
I would like to look at just a part of the data. Can I specify in the plot function that I for example only want data from 2013 to be plotted.
And if I plot the function it only shows the years on the x-axis. Is it possible that it for example also shows the months on the axis? How can I do that?
Thanks in advance!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.