stem() output order in R In R, stem() produces the graph with "stems" in ascending order. Is there a code for obtaining them in descending order?

Example:


stem (cars$dist)



The decimal point is 1 digit(s) to the right of the |:

   0 | 14004678
   2 | 002466668822244466
   4 | 002668024466
   6 | 046806
   8 | 04523
  10 | 
  12 | 0


The desired output:

  12 | 0
  10 | 
   8 | 04523
   6 | 046806
   4 | 002668024466
   2 | 002466668822244466
   0 | 14004678
Try to capture output, and modify it in a desired way:

rev.stem &lt;- function(data){
  out &lt;- capture.output(stem(data))
  out &lt;- c(out[1:3], rev(out[4:length(out)]))
  cat(out, sep="\n")
}

rev.stem(cars$dist)