【发布时间】:2025-11-30 16:15:02
【问题描述】:
我有一个简单的问题。我有两个变量,想应用 count(),plyr 包,以便找出有多少 1 和 2 的“a”分数,多少 1 和 2 的“b”分数等。试图这样做,我只是得到错误消息。
x=c(rep(1,5), rep(2,5))
y=c("a", "a", "b", "c", "d", "b", "a", "c", "c" ,"c")
df=data.frame(x,y)
df2=count(df$x, df$y)
谢谢!
【问题讨论】:
-
table(df$x, df$y)
标签: r