Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 204847

order() function gives wrong order for characters in R

$
0
0
xx = c("calculated_p3", "calculated_c1" ,"calculated_p2" ,"calculated_c2", "calculated_d2",
"calculated_d3", "calculated_c3", "calculated_p1" ,"calculated_d1")

order(xx)

The output is: 2 4 7 9 5 6 8 3 1

Why is the "calculated_d1" ordered as the first element? And why is "calculated_c2" ordered as the 9th element? I don't understand here. Shouldn't "calculated_c1" be the first one?

Thank you for your help


Viewing all articles
Browse latest Browse all 204847

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>