sortBy | R Documentation |
sortBy Sort a dataframe according to a field optionnaly decreasing
sortBy(data, field, decreasing = FALSE, na.last = TRUE)
data |
The dataframe to besorted |
field |
The field on which to sort (numeric or character). |
decreasing |
Default is FALSE |
na.last |
Should NA be at the end ? |
The sorted dataframe
df <- data.frame(one=c(2,1,2,1),two=c(2,2,1,1))
df <- sortBy(df,"one")
df <- sortBy(df,1)
df <- sortBy(df,one)
df <- sortBy(df,df$one)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.