The dataframe. "temperatures"
date temp1 temp2 temp3 temp4 temp5 temp6 temp7 temp8 nacolumn
1: dmYY 22 45 31 12 98 77 64 11 value
2: dmYY .. .. .. .. .. .. .. .. value
3: dmYY 04 02 10 16 14 12 08 06 value
The result we are going for (sorted per row by column integer).
date temp1 temp2 temp3 temp4 temp5 temp6 temp7 temp8 nacolumn
1: dmYY 11 12 22 31 45 64 77 98 value
2: dmYY .. .. .. .. .. .. .. .. value
3: dmYY 02 04 06 08 10 12 14 16 value
For plotting individual smoothed lines per-each-column over time, I am trying to re-order some (test) temperature data, the temp1 column being the lowest recorded : temp8 being the highest recorded.
There are a few questions that don't quite cover what I'm looking for ->
- R: Sort Across/Horizontally [duplicate]
- Sort data by row
t(apply(temperatures[,2:9]
- R: Calculate SD in each row over a selection of columns after removing minimum and maximum
- How to sort a dataframe by column(s)?
temperatures[ order(temperatures[,2:9]
I hope this isn't terribly simple but, in the case it is, please let me know.