具有这样的数据框:
df <- data.frame(id = c(1,2,3,4), stocks = c("google stock, yahoo product stock", "google stock, yahoo product stock","yahoo product stock", "google stock"))
如何获取这样的配对频率表:
google stock - yahoo product stock 2
google stock 1
yahoo product stock 1
答案 0 :(得分:0)
您想要这样的东西吗?
df <- data.frame(id = c(1,2,3,4), stocks = c("google stock, yahoo product stock",
"google stock, yahoo product stock",
"yahoo product stock",
"google stock"))
table(df$stocks)