select top rows in r code example
Example 1: r extract top values from data frame
top_myvar <- head(arrange(df, desc(myvar)), n = 10)
Example 2: dtidyverser get first x rows
# slice()
dt <- dt %>%
slice(1:4)
top_myvar <- head(arrange(df, desc(myvar)), n = 10)
# slice()
dt <- dt %>%
slice(1:4)