Sort descending all columns of data.frame
r
Solution
CD.sorted <- apply(CustomData, 2, sort, decreasing=F)
#2 == column, 1 == row
Problem
I'm fiddling with this now for a while, but can't find reasonable solution. I would like to sort in descending order all columns of data.frame. Sample data for instance: ``` CustomData <- data.frame(Value1=rnorm(100,1,2), Value2=rnorm(100,2,3), Value3=rexp(100,5), Value4=rexp(100,2)) ``` Works for one column: ``` CustomData[order(CustomData$Value1, decreasing=FALSE), ] ``` How sort all the columns data in decreasing/increasing order in reasonable manner? Thx. I have also tried something like this as posted elsewhere, but doesn't work as stated. ``` CustomData[do.call(order, as.list(CustomData)),] ```