2.7. Using summary reports to see information about an entire buffer
Prev | Chapter 2. Basic Pantry commands | Next

## 2.7. Using summary reports to see information about an entire buffer

So far, all the reports you have seen print one report for each food. For instance, the `names` report prints the name of each food in the buffer, and the `nuts` report prints one `nuts` report for each food in the buffer.

Sometimes you will want to know information about an entire buffer, rather than about each food in the buffer. Two reports provide information about the entire buffer: `sum` and `groups`.

### 2.7.1. Using the `sum` report

The `sum` report prints information about the sum of all nutrients of every food in the buffer. Like `nuts` reports, it uses nutrient lists to determine which nutrients appear in the report and which goals to use. It looks almost identical to the `nuts` report, with one difference: it has only three columns, rather than four. The first column shows the nutrient name; the second shows the nutrient amount; and the third shows the amount's percentage of a goal defined in the nutrient list.

As with the reports we discussed earlier, you may combine summary reports with other reports, as the next example demonstrates by combining a `traits` report and a `sum` report. When you combine summary reports and food reports, the summary reports are always shown last.

Example 2.20. Using the `sum` report

    $ pantry --name Bananas --print traits-blank-sum master
    Bananas, dehydrated, or banana powder
    Group: Fruits and Fruit Juices
    100 g (100g)

    Bananas, raw
    Group: Fruits and Fruit Juices
    Refuse: 36 percent Skin
    100 g (100g)

    Cereals ready-to-eat, KELLOGG'S, CORN FLAKES With Real Bananas
    Group: Breakfast Cereals
    100 g (100g)

    SUM:
    Nutrient                  Amount         %G
    -----------------------------------------------------
    Calories                  852  kcal       43
    Total Fat                 11   g          17
    Saturated Fat             8    g          42
    Cholesterol               0    mg         0
    Sodium                    456  mg         19
    Total Carbohydrate        195  g          65
    Dietary Fiber             15   g          60
    Sugars                    85   g          NA
    Protein                   8    g          16
    Vitamin A                 1983 IU         40
    Vitamin C                 43   mg         71
    Calcium                   56   mg         6
    Iron                      7    mg         41

As with `nuts` reports, you use nutrient lists to determine which nutrients are shown in the `sum` report, and what the goals are.

Example 2.21. Using the `--nutrient-list` option with the `sum` report

    $ pantry --name Bananas --print traits-blank-sum --nutrient-list short \
    > master
    Bananas, dehydrated, or banana powder
    Group: Fruits and Fruit Juices
    100 g (100g)

    Bananas, raw
    Group: Fruits and Fruit Juices
    Refuse: 36 percent Skin
    100 g (100g)

    Cereals ready-to-eat, KELLOGG'S, CORN FLAKES With Real Bananas
    Group: Breakfast Cereals
    100 g (100g)

    SUM:
    Nutrient                  Amount         %G
    -----------------------------------------------------
    Calories                  852  kcal       NA
    Total Fat                 11   g          NA
    Total Carbohydrate        195  g          NA
    Protein                   8    g          NA

### 2.7.2. Using the `groups` report

The other summary report is the `groups` report. It prints a list of all the groups in the buffer, the number of foods in each, and the total number of foods and groups. For instance, you can run the following example to see how many groupsa and foods are in the `master` file. Remember that if you do not specify any search options, pantry copies all foods from the files you specify into the buffer, which is why this example shows you all the groups in the `master` file.

Example 2.22. How many groups are in the `master` file?

    $ pantry --print groups master
      Group                               No. of Foods
    ------------------------------------------------------------
      Baby Foods                              314
      Baked Products                          482
      Beef Products                           747
      Beverages                               261
      Breakfast Cereals                       433
      Cereal Grains and Pasta                 176
      Dairy and Egg Products                  221
      Ethnic Foods                            150
      Fast Foods                              357
      Fats and Oils                           220
      Finfish and Shellfish Products          255
      Fruits and Fruit Juices                 314
      Lamb, Veal, and Game Products           343
      Legumes and Legume Products             254
      Meals, Entrees, and Sidedishes          130
      Nut and Seed Products                   128
      Pork Products                           310
      Poultry Products                        358
      Sausages and Luncheon Meats             232
      Snacks                                  134
      Soups, Sauces, and Gravies              502
      Spices and Herbs                         61
      Sweets                                  334
      Vegetables and Vegetable Products       803
    ------------------------------------------------------------
                                             7519 foods total
                                               24 groups total

Prev | Up | Next
2.6. Using nutrient lists to compare foods to particular nutrient goals | Home | 2.8. Saving new foods with `--add` and `--edit`; deleting with the `--delete` option