select top one row from a dataframe 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)