View source: R/AzzortiAnalysis.R
1 | gen_table(df_base)
|
df_base |
The data must be constituted as follows: |
1) CODI_CAMP: Sales campaign (ej. 201718..201909)
2) NOMB_LINE: Line of the SKU (ej. "JO JOYERIA")
3) CODI_VENT: Sales code SKU (ej. 123456)
4) DESCRIPCION: Name of the SKU.
5) REAL: Real Demand SKU.
7) Q_RG3: Traditional forecast for the SKU.
8) Q_MKT: Marketing area estimate.
9...) Comparative Models (ej. "Q_20", "Q_30")
#) Must be the "Besty Model" (Q_BESTY)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | #Headers
DF_TOTAL <- data.frame(CODI_CAMP = "",
NOMB_LINE = "",
CODI_VENT = "",
DESCRIPCION = "",
REAL = "",
Q_RG3 = "",
Q_MKT = "",
Q_30 = "",
Q_50 = "",
Q_70 = ""
)
DF_TOTAL<- DF_TOTAL[-c(1:nrow(DF_TOTAL)),]
campanas<- c(201901, 201902, 201903, 201904)
acumula<- DF_TOTAL
for(i in 1: length(campanas)) {
#i=1
acumula <- data.frame(CODI_CAMP = campanas[i],
NOMB_LINE = "RE ROPA EXTERIOR",
CODI_VENT = ceiling(runif(100,100000,999999)),
DESCRIPCION = paste0("P",c(1:100)),
REAL = 1000+(1:100)*10,
Q_RG3 = abs(1000+(1:100)*10 + rnorm(100,300,800)),
Q_MKT = abs(1000+(1:100)*10 + rnorm(100,100,700)),
Q_30 = abs(1000+(1:100)*10 + rnorm(100,400,700)),
Q_50 = abs(1000+(1:100)*10 + rnorm(100,450,900)),
Q_70 = abs(1000+(1:100)*10 + rnorm(100,700,900))
)
DF_TOTAL<- rbind(DF_TOTAL,acumula)
}
#
DF_TOTAL<-gen_q_besty(DF_TOTAL)
#
TABLA2<- gen_table(DF_TOTAL)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.