我已经找到了答案,但遗憾的是,他没有成功。我想创建一个基于以下条件识别重复的变量:
以下是使用'计数器'的数据集示例。变量是我想要的结果。
df = data.frame(A = rep(1:2, c(13,7)),
B = c(3,1,1,1,1,1,3,3,1,2,1,1,1,1,1,3,3,3,2,1),
C = c("b","s","f","b","s","b","b","s","s","s","f","p","s","p","f","b","s","p","f","p"),
counter = c(1,2,2,2,2,2,3,3,4,4,5,5,5,6,6,7,7,7,8,9))
感谢您的帮助!