# Time series analysis for univariate data but multiple datasets

I want to coduct a forecast analysis on my dataset. Some insights into the dataset:

• I have 10 Products each having a specific Id Number. These numbers are random and dont have any pattern.
• Each product has data starting from the year 2016 till 2018 for each month. So, 36 Observation Points for each product.

All these products are present in a single dataset in the column format and a total of 300 rows (certain products have missing data):

Column names: Prod_Id Year Month Sales_data

Would appreciate a guidance on the optimal approach that can be taken?

I am thinking of the following:

• Create a new vector with the unique Product_Ids and use its length to create a Loop
• Perform the forecast Analysis for one of the products and contain it in a Loop for other variables.

I am absolutely new to R and would appreciate any help/suggestions.

1. Create a time series ts for the data of each product: myts <- ts(mydata_for_product_i, start=c(2016, 1), end=c(2018, 12), frequency=12)
2. Apply your forescast analysis to each mytsinside the loop and store them in a list.
A fancier way to do would be using fuctions oof the apply family, but without having the structure of your data I cannot produce any code I am sure to work