这可能是一个更容易的。(首选 tidyverse 解决方案)
两个问题 Q1. 为什么下面没有按最大 Sepal.Length 值给我前 4 行
library(tidyverse)
1. iris %>% top_n(Sepal.Length,4)
Q2我想做与top_n相反的slice_max。我想显示数据框中没有前 n 行的数据框
library(tidyverse)
#something like below
iris %>% filter(!top_n(Sepal.Length,4))
1. 的输出应该是 4 行,2. 的输出应该是 146 行(150-4 行由顶部 Sepal.Length 值不带关系)