Skip to content

Independant column sorting using sort.list

2 messages · Jeremy Z Butler, Douglas Bates

#
Hi,
I'm trying to _independantly_ sort the columns of a data frame. 

Using:
the columns are sorted *by the first row*.
 
How would I modify this so that all columns are sorted independantly (the result
being *all* columns are rearranged from smallest to biggest not just the first)?

Cheers, Jeremy
#
Jeremy Z Butler <jeremybutler at paradise.net.nz> writes:
Apply the sort rather than using sort.list.

varespec <- data.frame(lapply(varespec, sort))