提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档
事件路径分析
分析案例—游戏点击事件路径分析
read.table(sep="###")
test <- read.csv("./data/chapter07/test1.csv",header=F,fileEncoding = “UTF-8”)
data_click <- read.csv("./data/chapter07/data_click.csv",header=F) # 导入点击事件数据
head(data_click) # 查看前六行
nrow(data_click)
提取有过11034点击行为的用户数据
targetuserid <- unique(data_click[data_clickKaTeX parse error: Expected 'EOF', got '#' at position 19: …="11034","V1"])#̲实现了? str(target…V1 %in% targetuserid,]#实现了?
str(data_click_new)
将数据转化成事务型
#install.packages(“arulesSequences”)
library(arulesSequences)
tmp_data <- data.frame(click=data_click_new V 3 ) s t r ( t m p d a t a ) t m p d a t a V3) str(tmp_data) tmp_data V3)str(tmpdata)tmpdataclick <- as.factor(tmp_data c l i c k ) s t r ( t m p d a t a ) d a t a c l i c k t r a n < − a s ( t m p d a t a , ′ t r a n s a c t i o n s ′ ) s t r ( d a t a c l i c k t r a n ) t r a n s a c t i o n I n f o ( d a t a c l i c k t r a n ) click) str(tmp_data) data_click_tran <- as(tmp_data,'transactions') str(data_click_tran) transactionInfo(data_click_tran) click)str(tmpdata)dataclicktran<−as(tm