RFM分析细分

时间:2019-02-13 07:48:13

标签: r

实际上,RFM分析很容易,但是当我根据新近度,频率和货币得分对客户进行分类时,我会遇到以下示例:

  • 休眠中:R:1-2,F:1-2,M:1-2
  • 丢失:R:<= 2,F:<= 2,M:<= 2

如果客户的得分为111或222,该怎么办?以上两个细分都包括111或222得分。

This example是我在说的。

我的解决方法是:

df$RFMClass <- with(df, ifelse(R %in% 4:5 & F %in% 4:5 & M %in% 4:5, "Champions","Other"))
df$RFMClass <- with(df, ifelse(R %in% 2:5 & F %in% 3:5 & M %in% 3:5 & RFMClass != "Champions", "Loyal Customers", RFMClass))
df$RFMClass <- with(df, ifelse(R %in% 3:5 & F %in% 1:3 & M %in% 1:3 & RFMClass != "Champions" & RFMClass != "Loyal Customers", "Potential Loyalist", RFMClass))
df$RFMClass <- with(df, ifelse(R %in% 4:5 & F <= 1 & M <= 1 & RFMClass != "Champions" & RFMClass != "Loyal Customers" & RFMClass != "Potential Loyalist", "New Customers", RFMClass))
df$RFMClass <- with(df, ifelse(R %in% 3:4 & F <= 1 & M <= 1 & RFMClass != "Champions" & RFMClass != "Loyal Customers" & RFMClass != "Potential Loyalist" & RFMClass != "New Customers", "Promising", RFMClass))
df$RFMClass <- with(df, ifelse(R %in% 2:3 & F %in% 2:3 & M %in% 2:3 & RFMClass != "Champions" & RFMClass != "Loyal Customers" & RFMClass != "Potential Loyalist" & RFMClass != "New Customers" & RFMClass != "Promising", "Need Attention", RFMClass))
df$RFMClass <- with(df, ifelse(R %in% 2:3 & F <= 2 & M <= 2 & RFMClass != "Champions" & RFMClass != "Loyal Customers" & RFMClass != "Potential Loyalist" & RFMClass != "New Customers" & RFMClass != "Promising" & RFMClass != "Need Attention", "About To Sleep", RFMClass))
df$RFMClass <- with(df, ifelse(R <= 2 & F %in% 2:5 & M %in% 2:5 & RFMClass != "Champions" & RFMClass != "Loyal Customers" & RFMClass != "Potential Loyalist" & RFMClass != "New Customers" & RFMClass != "Promising" & RFMClass != "Need Attention" & RFMClass != "About To Sleep", "At Risk", RFMClass))
df$RFMClass <- with(df, ifelse(R <= 1 & F %in% 4:5 & M %in% 4:5 & RFMClass != "Champions" & RFMClass != "Loyal Customers" & RFMClass != "Potential Loyalist" & RFMClass != "New Customers" & RFMClass != "Promising" & RFMClass != "Need Attention" & RFMClass != "About To Sleep" & RFMClass != "At Risk", "Can’t Lose Them", RFMClass))
df$RFMClass <- with(df, ifelse(R %in% 1:2 & F %in% 1:2 & M %in% 1:2 & RFMClass != "Champions" & RFMClass != "Loyal Customers" & RFMClass != "Potential Loyalist" & RFMClass != "New Customers" & RFMClass != "Promising" & RFMClass != "Need Attention" & RFMClass != "About To Sleep" & RFMClass != "At Risk" & RFMClass != "Can’t Lose Them", "Hibernating", RFMClass))
df$RFMClass <- with(df, ifelse(R <= 2 & F <= 2 & M <= 2 & RFMClass != "Champions" & RFMClass != "Loyal Customers" & RFMClass != "Potential Loyalist" & RFMClass != "New Customers" & RFMClass != "Promising" & RFMClass != "Need Attention" & RFMClass != "About To Sleep" & RFMClass != "At Risk" & RFMClass != "Can’t Lose Them" & RFMClass != "Hibernating", "Lost", RFMClass))

如果需要修复它或任何带有分类解决方案的好例子。

0 个答案:

没有答案