| rp_sort | R Documentation |
Sorts a data frame by one or more columns. It translates the R expressions
into a pandas .sort_values() command and executes it.
rp_sort(.data, ..., table_name = NULL, return.as = "result")
.data |
An R data.frame or tibble. |
... |
Bare column names to sort by. Use |
table_name |
An optional character string. If provided, the generated Python code will replace the internal dataframe name with this string (e.g., |
return.as |
What to return: "result", "code", or "all". |
A data.frame sorted by the specified columns.
if (reticulate::py_available(initialize = TRUE) &&
reticulate::py_module_available("pandas")) {
# Sort by cut (ascending) and price (descending)
rp_sort(ggplot2::diamonds, cut, desc(price))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.