sortdataframe | R Documentation |
Sorts a data frame by one or more columns specified by name or number
sortdataframe(x, decreasing = FALSE, by = 1, ...)
x |
A data frame |
decreasing |
Logical; should the sort be in decreasing order? |
by |
Column name(s) or number(s) to sort by |
... |
Additional arguments passed to order() |
Sorted data frame
df <- data.frame(x=c(2,1,3), y=c("b","a","c"))
sortdataframe(df, by="x") # Sort by x column
sortdataframe(df, by=c("x","y")) # Sort by multiple columns
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.