In R I have a data frame with 9 named columns, describing experimental data. The first column contains gene names, and the following 8 columns contain gene expression values. The ultimate goal is to sort the data frame by the standard deviation of the expression values.
Basically, I want to compute the standard deviation of columns 2 to 9 and sort the entire data frame according to these values. How can I do that?
My first idea was to add a tenth column with the standard deviation, computed using the sd() function, then sorting the table, finally deleting the tenth column again. But I can not figure out how to do that.
The key commands are:
apply,order, and some row rearrangement.