# Minimum value of every group in table

I have a table with this format. How can I get the minimum value of every group and put it in another list?

{{x1, x2, x3, x4}, {x5, x6, x7, x8}, {x9, x10, x11, x12}}

• Min /@ yourList? Look up Map in the documentation (its infix form is /@). Commented Apr 22, 2020 at 5:22
• Thank you very much. Commented Apr 22, 2020 at 5:26

## 3 Answers

m =
{{4, 2, 3, 1},
{5, 8, 5, 7},
{4, 3, 3, 3}};


Using ArrayReduce (new in 12.2)

Row Minima

ArrayReduce[Min, m, 2]


{1, 5, 3}

Column Minima

ArrayReduce[Min, m, 1]


{4, 2, 3, 1}

m = {{4, 2, 3, 1}, {5, 8, 5, 7}, {4, 3, 3, 3}};


Using Outer, Thread and Min:

{#, Min @@@ Outer[List, #] & /@ {#, Thread@#} &@#} &@m

(*{{{4, 2, 3, 1}, {5, 8, 5, 7}, {4, 3, 3, 3}}, {{1, 5, 3}, {4, 2, 3, 1}}}*)


Random enough but the results can be verified easily by inspection with the following strategy.

SeedRandom[11];
(m = Range[21] // Partition[#, 7] & //
RotateLeft[#, {4, 1}] &) // MatrixForm

RankedMin[#, 1] & /@ m

MinimalBy[#, # &] & /@ m // Flatten

Min /@ m (* comment from @MarcoB *)


Result::

{8, 15, 1}


For columns, use Transpose@m with all variants, e.g. :

Min /@ Transpose@m


{4, 5, 6, 7, 1, 2, 3}