Description Usage Arguments Value Examples
View source: R/Helper_Functions.R
Sort a table by a column, replace row names as 1:n, and return the table via pander
for clean display. This is necessary after sorting because pander will display row names if they are not 1:n or NULL.
1 | pander_sort(data, x, ...)
|
data |
A dataframe or object that can be coerced into a data frame (will be done via |
x |
The column name to sort by, quoted or unquoted |
... |
Additional named parameters to be passed to pander() |
From pander
: By default this function outputs (see: cat) the result. If you would want to catch the result instead, then call the function ending in .return.
1 2 3 4 5 6 7 8 | x <- data.frame(fruit = c("banana", "apple", "kiwi"),
weight = c(4.5, 3.6, 1.2))
## Sorting manually:
pander::pander(x[order(x$fruit),])
## Sorting and fixing row names:
pander_sort(x, fruit)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.