I want the rounding of a set of numbers to automatically change as the numbers get larger. I am making barplot labels. Here is what currently shows up:
<39
39 to 11564
11564 to 23090
23090 to 50893
50893 to 89034
89034 to 138900
138900 to 183562
I think the number 39 is important, that is, I do not want to apply round() to all of the numbers equally because I do not want to change 39 to 40. I am writing a function so I need something that will adjust the amount it rounds based on the size of the number.
Ideal rounding:
<39 . ( when 2 or 3 digits long, do not round)
39 to 11600 ( when 5 digits long, round to 3 places)
11600 to 23000
23000 to 50900
50900 to 89000
89000 to 139000 ( when 6 digits long, round to 4 places)
139000 to 184000
does this already exist, where I can specify rounding by length? Or should I just write my own helper function to try to do this separately.
Thanks for the help! Best, Tessa