0
我遇到了group_by的一些问题。我知道我的分组变量有两个级别,但是group_by只返回其中的一个。group_by不返回分组变量中的所有级别
我在做什么错?
y是我的分组variabel两个级别,但该命令返回此输出只有一行:
mean Q10 Q50 Q90
1 16.5 1.1 7.5 49
下面的代码重现的问题。
#A dataset:
v <- c(1,2,3,4,5,10,20,30,40,50)
y <- rep(0:1, each = 5)
a <- as.data.frame.matrix(cbind(v,y))
#The group_by command that doesn't work
a %>% group_by(y) %>% summarize(mean = mean(v),
Q10 = quantile(v, 0.1, type=6),
Q50 = quantile(v, 0.5, type=6),
Q90 = quantile(v, 0.9, type=6))
你说得对 - 我刚刚意识到这一点,并且来到这里删除了这个问题。谢谢你的回复。 –