I would like to do a bit more advocacy for the use of Associations. This discussion has been useful to me because it caused me to look more deeply into Associations. By attaching data to keys, Associations make it much easier to manipulate and extract subsets of the data while maintain identifications. Even a short list of numbers can be better as an Association because it provides context to the numbers,
Here we construct a longer list of integer triplets as test data. (The results will vary depending on the random set generated.)
list = Array[RandomInteger[{1, 99}] &, {1000, 3}];
caseData = Association @@ Table[data[i] -> list[[i]], {i, 1, Length[list]}];
We would probably not wish to look at a list that's a 1000 items long. We can easily look at specific items.
KeyTake[caseData, {data[122], data[453]}]
giving
<|data[122] -> {95, 69, 21}, data[453] -> {42, 79, 13}|>
We can make a new association that contains the totals of each triplet list, and find the min and max values.
totalData = Total /@ caseData;
MinMax[totalData]
giving
{22, 265}
We can select data by a specific criterion.
range1Data = Select[totalData, 100 <= # <= 105 &] // Sort;
Labeled[Dataset[range1Data], "Totals between 100 and 105", Top]
(I don't know how to paste an image of a Dataset into a posting. You will have to run the code. It gives a table list of the data with controls for moving through the table.)
We can extract the matching underlying data.
range1Keys = Keys[range1Data];
Labeled[Dataset@
KeyTake[caseData,
range1Keys], "Underlying data for\ntotals between 100 and 105", Top]
Or we can assemble a data association that composes the totals and underlying data and display it with headings.
range1Composite =
Association@
Table[case ->
Association["triplets" -> caseData[case],
"total" -> range1Data[case]], {case, range1Keys}];
Labeled[Dataset[range1Composite], "Totals between 100 and 105", Top]
This gives a table with both row and column headings and an overall label at the top, and controls for scrolling through it.
Associations and Datasets are a versatile method for examining and performing calculations on sets of data.