rfm_result <- rfm_table_customer(baseRFM,
customer_id = X,
recency_days = Recencia,
n_transactions = Frecuencia,
total_revenue = TOTAL)
#Heat Map
rfm_heatmap(rfm_result)

#Bar Chart
rfm_bar_chart(rfm_result)

#Histogram
rfm_histograms(rfm_result)

#Customers by Orders
rfm_order_dist(rfm_result)

### MODELADO 2
ggplot(data = a) + aes(x = cus_seg, fill = cus_seg)+ geom_bar() +
geom_text(aes(label=scales::percent(..count../sum(..count..))),
stat='count',position=position_dodge(1))+
labs(title = "Customer Segmentation", x = "Segment", y = "Total Customer") + coord_flip()+ theme_minimal()

ggplot(data = a) + aes(x = cus_seg, fill = cus_seg)+ geom_bar() +
geom_text(aes(label=(..count..)),
stat='count',position=position_dodge(1))+
labs(title = "Customer Segmentation", x = "Segment", y = "Total Customer") + coord_flip()+ theme_minimal()
