如何基于值对表进行子集并返回这些值?这将返回刚刚指数:如何在R中对表对象进行子集化?
with(chickwts, table(feed))
with(chickwts, table(feed)) > 11
which(with(chickwts, table(feed)) > 11)
输出
> with(chickwts, table(feed))
feed
casein horsebean linseed meatmeal soybean sunflower
12 10 12 11 14 12
> with(chickwts, table(feed)) > 11
feed
casein horsebean linseed meatmeal soybean sunflower
TRUE FALSE TRUE FALSE TRUE TRUE
> which(with(chickwts, table(feed)) > 11)
casein linseed soybean sunflower
1 3 5 6
啊,是的,当然,谢谢! – jrara
或者有点重复的代码:'with(chickwts,table(feed)[table(feed)> 11])' – A5C1D2H2I1M1N2O1R2T1