In R I can do:


Which gives the min, max, median, first, and third quartiles. Is there a similar single command in Mathematica for this?

I know I can do:

data = RandomInteger[{0, 100}, 100]
Table[f[data], {f, {Min, Quantile[#, .25] &, Median, 
   Quantile[#, .75] &, Max}}]

But wondering if there is a single command for this.

  • 1
    $\begingroup$ No, there isn't. $\endgroup$
    – Stefan R
    Sep 11, 2015 at 21:42
  • 5
    $\begingroup$ @StefanR - Actually, since Quantile accepts a list of quantiles: Quantile[data, Range[0, 1, .25]] $\endgroup$
    – Bob Hanlon
    Sep 11, 2015 at 22:46

2 Answers 2


Even if there wasn't one, there is one now: I think you've just written it yourself :-)

summary[dset_] := Through[{Min, Quantile[#, .25] &, Median, Quantile[#, .75] &, Max}[dset]]

data = RandomInteger[{0, 100}, 100];

(* Out: {0, 18, 91/2, 66, 98} *)
  • $\begingroup$ Addendum: there might be a situation where one might need to fiddle with the third argument of Quantile[]. See e.g. this. $\endgroup$ Oct 7, 2015 at 11:49
  • $\begingroup$ @J.M. ah! Interesting, thank you for pointing it out. I'm delighted to see that you're back! $\endgroup$
    – MarcoB
    Oct 7, 2015 at 12:28

On 2019-10-02 the resource function "RecordsSummary" was published at the Wolfram Function Repository.

Here is usage example (from the resource function page):

Block[{n = 200}, 
  arr = Flatten /@ 
    Transpose[{RandomReal[{-10, 10}, {n, 2}], 
       RandomChoice[CharacterRange["A", "Z"], {n, 2}], {All, 2}], 
      RandomChoice[{E, I, \[CapitalGamma]}, n]}]];


enter image description here

First answer (2016-02-25)

Some time ago I programmed such a function, RecordsSummary, inspired by R's summary. Here is an example of its usage: Census data summary .

As the name implies, it is assumed that we have a list of records, all with the same length, and we want the columns to be summarized. (Each record is a row.)

You can get the package MathematicaForPredictionUtilities.m from MathematicaForPrediction at GitHub or simply run this command:


Let us create random data.

data = RandomInteger[{0, 100}, 100];
dataCat = RandomChoice[Characters["azbuka"], 100];
data2 = RandomInteger[{0, 100}, {100, 4}];

Here are examples of using RecordsSummary over the created data.

1. Call on a 1D array:

RecordsSummary[ data ]

2. Summary of a 2D numeric array. The columns are named automatically.


RecordsSummary output for 2D numerical array

3. Fancy output of numerical and categorical data summary. The column names are the second argument given to RecordsSummary.

   Transpose[{N[data], dataCat}], {"Numeric", "Categorical"}]}, 
 Alignment -> Top, Dividers -> All]

RecordsSummary output for numerical and categorical data

  • $\begingroup$ Can we have Recordsummary with respective to two variables that is, a response variable that is categorical and a predictor variable that is numeric? $\endgroup$
    – Srajan
    Dec 1, 2019 at 23:07
  • $\begingroup$ @Srajan I am not sure what do you meant. The answer is "yes" to both interpretations I can come up with. 1. If you have two columns, a categorical and a numerical one, then see the last example in this answer. 2. If you mean an association of number-symbol pairs, then you can use ResourceFunction["RecordsSummary"][asc, Thread -> True]. $\endgroup$ Dec 2, 2019 at 12:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.