How can I sort my rows which are in yyyy-mm-dd format to be descending in rpivottable output in Shiny r?
I expect rows to be most recent to older dates. I know for example how to sort by month using the below code in the sorter part, but not in date format.
sorters="
function(attr) {
var sortAs = $.pivotUtilities.sortAs;
if (attr == \"ContractCalendarMonth\")
{
return sortAs([\"7\", \"8\", \"9\", \"10\", \"11\", \"12\", \"1\", \"2\", \"3\",\"4\", \"5\", \"6\"]);
}
}"
To reverse the date so that the most recent dates are in the first rows of the rpivotTable is to put the below code into the sorters option of the rpivotTable.
sorters = "function(attr) {
var sortAs = $.pivotUtilities.sortAs;
if (attr == \"Date\")
{ return sortAs; }
}"