Skip to main content
Tweeted twitter.com/StackMma/status/1103445329851138054
Became Hot Network Question
Small syntax change
Source Link
Wombles
  • 802
  • 4
  • 8

my current code is:

binsize = 21;
data = {535, 481, 554, 567, 565, 513, 526, 506, 565, 475, 552, 533, 
   474, 556, 520, 508, 597, 479, 537, 499, 546, 473, 579, 526, 594, 
   477, 518, 538, 497, 565};
firstbin = 472;
a = BinCounts[data, {firstbin, Max[data] + binsize, binsize}];
b = Range[472Range[firstbin, Max[data] + binsize, 21];binsize];
Transpose[{Take[b, Length[a]], a}] // TableForm

Which does give me a nice table, however I would like the bins to be labeled something like "472-492 6" instead of just "472 6"

any advice would be great, thank you.

my current code is:

binsize = 21;
data = {535, 481, 554, 567, 565, 513, 526, 506, 565, 475, 552, 533, 
   474, 556, 520, 508, 597, 479, 537, 499, 546, 473, 579, 526, 594, 
   477, 518, 538, 497, 565};
firstbin = 472;
a = BinCounts[data, {firstbin, Max[data] + binsize, binsize}];
b = Range[472, Max[data] + binsize, 21];
Transpose[{Take[b, Length[a]], a}] // TableForm

Which does give me a nice table, however I would like the bins to be labeled something like "472-492 6" instead of just "472 6"

any advice would be great, thank you.

my current code is:

binsize = 21;
data = {535, 481, 554, 567, 565, 513, 526, 506, 565, 475, 552, 533, 
   474, 556, 520, 508, 597, 479, 537, 499, 546, 473, 579, 526, 594, 
   477, 518, 538, 497, 565};
firstbin = 472;
a = BinCounts[data, {firstbin, Max[data] + binsize, binsize}];
b = Range[firstbin, Max[data] + binsize, binsize];
Transpose[{Take[b, Length[a]], a}] // TableForm

Which does give me a nice table, however I would like the bins to be labeled something like "472-492 6" instead of just "472 6"

any advice would be great, thank you.

Source Link
Wombles
  • 802
  • 4
  • 8

Formatting a table to look nice

my current code is:

binsize = 21;
data = {535, 481, 554, 567, 565, 513, 526, 506, 565, 475, 552, 533, 
   474, 556, 520, 508, 597, 479, 537, 499, 546, 473, 579, 526, 594, 
   477, 518, 538, 497, 565};
firstbin = 472;
a = BinCounts[data, {firstbin, Max[data] + binsize, binsize}];
b = Range[472, Max[data] + binsize, 21];
Transpose[{Take[b, Length[a]], a}] // TableForm

Which does give me a nice table, however I would like the bins to be labeled something like "472-492 6" instead of just "472 6"

any advice would be great, thank you.