Hi there,

I am facing the following issue:

I have a dataframe Actuals [months, products] which has forecasts on a monthly level.

Now I need to convert it into days and then calender weeks by the following formula:

(demand in month/days in month ) *days in week =demand CW

Since for some CWs the months are overlapping I have figured the following logic

month / p^1 /p^2 etc....

1 /100

2 /200

3/100

.....

I need so create a vector containing the days in month acordingly

monthly_divisor<- c(31,28,31,30,31,30,31,31,30,31,30,31,31,28,31,30,31,30)

and divide the data by the number of days in week.

Then I need to make a long list where the first month is replicated 31 times and Febrary 29 times and so on ...

Last but not least I summarize the Calender weeks accordingly.

The thing is that I do not know really how to start, as I am very new to R and I have a tight schedule for my Thesis.

Can anybody help me on this?

I read that the best way would be to write a function and run it with adply ()....

UPDATE:

See the approach below but I would still need help ....