Skip to main content
deleted 2 characters in body
Source Link
kglr
  • 400.5k
  • 18
  • 488
  • 929

You can use HistogramList to get bin limits and bin counts in one step and process the output to get the desired structure:

{binlims, bincounts} = HistogramList[data, {firstbin, Max[data] + binsize, binsize}];
bins = Row[{#, #2 - 1}, "-"] & @@@ Partition[binlims, 2, 1];
TableForm[Transpose[{bins, bincounts}]]

enter image description here

Alternatively, you can use MovingMap, Developer`PartitionMap or the (undocumented) 6-argument form of PartititionPartition to get the first column:

bins2 = MovingMap[Row[{First@#, Last@# - 1}, "-"] &, binlims, 1]
bins3 = Developer`PartitionMap[Row[{First@#, Last@# - 1}, "-"] &, binlims, 2, 1];
bins4 = Partition[binlims, 2, 1, {1, -1}, {}, Row[{#, #2 - 1}, "-"] &];
bins == bins2 == bins3 == bins4

True

Finally, you can also use a combination of StringRiffle and ToString in place of Rowas follows:

bins5 = Partition[binlims, 2, 1, {1, -1}, {}, StringRiffle[ToString/@{#, #2 - 1}, " - "]&]
TableForm[Transpose[{bins5, bincounts}]]

enter image description here

You can use HistogramList to get bin limits and bin counts in one step and process the output to get the desired structure:

{binlims, bincounts} = HistogramList[data, {firstbin, Max[data] + binsize, binsize}];
bins = Row[{#, #2 - 1}, "-"] & @@@ Partition[binlims, 2, 1];
TableForm[Transpose[{bins, bincounts}]]

enter image description here

Alternatively, you can use MovingMap, Developer`PartitionMap or the (undocumented) 6-argument form of Partitition to get the first column:

bins2 = MovingMap[Row[{First@#, Last@# - 1}, "-"] &, binlims, 1]
bins3 = Developer`PartitionMap[Row[{First@#, Last@# - 1}, "-"] &, binlims, 2, 1];
bins4 = Partition[binlims, 2, 1, {1, -1}, {}, Row[{#, #2 - 1}, "-"] &];
bins == bins2 == bins3 == bins4

True

Finally, you can also use a combination of StringRiffle and ToString in place of Rowas follows:

bins5 = Partition[binlims, 2, 1, {1, -1}, {}, StringRiffle[ToString/@{#, #2 - 1}, " - "]&]
TableForm[Transpose[{bins5, bincounts}]]

enter image description here

You can use HistogramList to get bin limits and bin counts in one step and process the output to get the desired structure:

{binlims, bincounts} = HistogramList[data, {firstbin, Max[data] + binsize, binsize}];
bins = Row[{#, #2 - 1}, "-"] & @@@ Partition[binlims, 2, 1];
TableForm[Transpose[{bins, bincounts}]]

enter image description here

Alternatively, you can use MovingMap, Developer`PartitionMap or the (undocumented) 6-argument form of Partition to get the first column:

bins2 = MovingMap[Row[{First@#, Last@# - 1}, "-"] &, binlims, 1]
bins3 = Developer`PartitionMap[Row[{First@#, Last@# - 1}, "-"] &, binlims, 2, 1];
bins4 = Partition[binlims, 2, 1, {1, -1}, {}, Row[{#, #2 - 1}, "-"] &];
bins == bins2 == bins3 == bins4

True

Finally, you can also use a combination of StringRiffle and ToString in place of Rowas follows:

bins5 = Partition[binlims, 2, 1, {1, -1}, {}, StringRiffle[ToString/@{#, #2 - 1}, " - "]&]
TableForm[Transpose[{bins5, bincounts}]]

enter image description here

edited body
Source Link
kglr
  • 400.5k
  • 18
  • 488
  • 929

You can use HistogramList to get bin limits and bin counts in one step and process the output to get the desired structure:

{binlims, bincounts} = HistogramList[data, {firstbin, Max[data] + binsize, binsize}];
bins = Row[{#, #2 - 1}, "-"] & @@@ Partition[binlims, 2, 1];
TableForm[Transpose[{bins, bincounts}]]

enter image description here

Alternatively, you can use MovingMap, Developer`PartitionMap or th ethe (undocumented) 6-argument form of Partitition to get the first column:

bins2 = MovingMap[Row[{First@#, Last@# - 1}, "-"] &, binlims, 1]
bins3 = Developer`PartitionMap[Row[{First@#, Last@# - 1}, "-"] &, binlims, 2, 1];
bins4 = Partition[binlims, 2, 1, {1, -1}, {}, Row[{#, #2 - 1}, "-"] &];
bins == bins2 == bins3 == bins4

True

Finally, you can also use a combination of StringRiffle and ToString in place of Rowas follows:

bins5 = Partition[binlims, 2, 1, {1, -1}, {}, StringRiffle[ToString/@{#, #2 - 1}, " - "]&]
TableForm[Transpose[{bins5, bincounts}]]

enter image description here

You can use HistogramList to get bin limits and bin counts in one step and process the output to get the desired structure:

{binlims, bincounts} = HistogramList[data, {firstbin, Max[data] + binsize, binsize}];
bins = Row[{#, #2 - 1}, "-"] & @@@ Partition[binlims, 2, 1];
TableForm[Transpose[{bins, bincounts}]]

enter image description here

Alternatively, you can use MovingMap, Developer`PartitionMap or th e(undocumented) 6-argument form of Partitition to get the first column:

bins2 = MovingMap[Row[{First@#, Last@# - 1}, "-"] &, binlims, 1]
bins3 = Developer`PartitionMap[Row[{First@#, Last@# - 1}, "-"] &, binlims, 2, 1];
bins4 = Partition[binlims, 2, 1, {1, -1}, {}, Row[{#, #2 - 1}, "-"] &];
bins == bins2 == bins3 == bins4

True

Finally, you can also use a combination of StringRiffle and ToString in place of Rowas follows:

bins5 = Partition[binlims, 2, 1, {1, -1}, {}, StringRiffle[ToString/@{#, #2 - 1}, " - "]&]
TableForm[Transpose[{bins5, bincounts}]]

enter image description here

You can use HistogramList to get bin limits and bin counts in one step and process the output to get the desired structure:

{binlims, bincounts} = HistogramList[data, {firstbin, Max[data] + binsize, binsize}];
bins = Row[{#, #2 - 1}, "-"] & @@@ Partition[binlims, 2, 1];
TableForm[Transpose[{bins, bincounts}]]

enter image description here

Alternatively, you can use MovingMap, Developer`PartitionMap or the (undocumented) 6-argument form of Partitition to get the first column:

bins2 = MovingMap[Row[{First@#, Last@# - 1}, "-"] &, binlims, 1]
bins3 = Developer`PartitionMap[Row[{First@#, Last@# - 1}, "-"] &, binlims, 2, 1];
bins4 = Partition[binlims, 2, 1, {1, -1}, {}, Row[{#, #2 - 1}, "-"] &];
bins == bins2 == bins3 == bins4

True

Finally, you can also use a combination of StringRiffle and ToString in place of Rowas follows:

bins5 = Partition[binlims, 2, 1, {1, -1}, {}, StringRiffle[ToString/@{#, #2 - 1}, " - "]&]
TableForm[Transpose[{bins5, bincounts}]]

enter image description here

deleted 13 characters in body
Source Link
kglr
  • 400.5k
  • 18
  • 488
  • 929

You can use HistogramList to get bin limits and bin counts in one step and process the output to get the desired structure:

{binlims, bincounts} = HistogramList[data, {firstbin, Max[data] + binsize, binsize}];
bins = Row[{#, #2 - 1}, "-"] & @@@ Partition[binlims, 2, 1];
TableForm[Transpose[{bins, bincounts}]]

enter image description here

Alternatively, you can use MovingMap, Developer`PartitionMap or th e(undocumented) 6-argument form of Partitition to get the first column:

bins2 = Developer`PartitionMap[Row[MovingMap[Row[{First@#, Last@# - 1}, "-"] &, binlims, 2, 1];1]
TableForm[Transpose[bins3 = Developer`PartitionMap[Row[{bins2First@#, bincountsLast@# - 1}]], "-"] &, binlims, 2, 1];

same picture

You can also use the undocumented 6-argument form of Partititon:

bins3bins4 = Partition[binlims, 2, 1, {1, -1}, {}, Row[{#, #2 - 1}, "-"] &];
TableForm[Transpose[{bins == bins2 == bins3, bincounts}]]== bins4

same pictureTrue

Finally, you can also use a combination of StringRiffle and ToString in place of Rowas follows:

bins4bins5 = Partition[binlims, 2, 1, {1, -1}, {}, StringRiffle[ToString/@{#, #2 - 1}, " - "]&]
TableForm[Transpose[{bins4bins5, bincounts}]]

enter image description here

You can use HistogramList to get bin limits and bin counts in one step and process the output to get the desired structure:

{binlims, bincounts} = HistogramList[data, {firstbin, Max[data] + binsize, binsize}];
bins = Row[{#, #2 - 1}, "-"] & @@@ Partition[binlims, 2, 1];
TableForm[Transpose[{bins, bincounts}]]

enter image description here

Alternatively, you can use Developer`PartitionMap to get the first column:

bins2 = Developer`PartitionMap[Row[{First@#, Last@# - 1}, "-"] &, binlims, 2, 1];
TableForm[Transpose[{bins2, bincounts}]]

same picture

You can also use the undocumented 6-argument form of Partititon:

bins3 = Partition[binlims, 2, 1, {1, -1}, {}, Row[{#, #2 - 1}, "-"] &];
TableForm[Transpose[{bins3, bincounts}]]

same picture

Finally, you can also use a combination of StringRiffle and ToString in place of Rowas follows:

bins4 = Partition[binlims, 2, 1, {1, -1}, {}, StringRiffle[ToString/@{#, #2 - 1}, " - "]&]
TableForm[Transpose[{bins4, bincounts}]]

enter image description here

You can use HistogramList to get bin limits and bin counts in one step and process the output to get the desired structure:

{binlims, bincounts} = HistogramList[data, {firstbin, Max[data] + binsize, binsize}];
bins = Row[{#, #2 - 1}, "-"] & @@@ Partition[binlims, 2, 1];
TableForm[Transpose[{bins, bincounts}]]

enter image description here

Alternatively, you can use MovingMap, Developer`PartitionMap or th e(undocumented) 6-argument form of Partitition to get the first column:

bins2 = MovingMap[Row[{First@#, Last@# - 1}, "-"] &, binlims, 1]
bins3 = Developer`PartitionMap[Row[{First@#, Last@# - 1}, "-"] &, binlims, 2, 1];
bins4 = Partition[binlims, 2, 1, {1, -1}, {}, Row[{#, #2 - 1}, "-"] &];
bins == bins2 == bins3 == bins4

True

Finally, you can also use a combination of StringRiffle and ToString in place of Rowas follows:

bins5 = Partition[binlims, 2, 1, {1, -1}, {}, StringRiffle[ToString/@{#, #2 - 1}, " - "]&]
TableForm[Transpose[{bins5, bincounts}]]

enter image description here

added 223 characters in body
Source Link
kglr
  • 400.5k
  • 18
  • 488
  • 929
Loading
added 585 characters in body
Source Link
kglr
  • 400.5k
  • 18
  • 488
  • 929
Loading
Source Link
kglr
  • 400.5k
  • 18
  • 488
  • 929
Loading