The University of Melbourne · FACULTY OF STATISTICS

CMCE10002 Chap.7 The Pipe and Grouped Business Summaries

- one subject, every graph, every model, every mark
5 Chapters5-page Bible
Our own words - no uploaded lecturer files
Updated for this semester
Chapter 7 of 13 · CMCE10002

The Pipe and Grouped Business Summaries

Read the pipe as the word then

Real wrangling is rarely one verb. Written as nested calls a four-step transformation reads inside out and is hard to debug; the pipe hands whatever sits to its left straight into the opening slot of whatever sits to its right, so the same steps read top to bottom in the order they happen.

It changes nothing about what the code computes.

Grouping attaches a label and moves nothing

The lecture is explicit: the operation moves nothing at all. Row for row the table is what it was, in the order it was, holding the values it held.

Each row simply gains a label naming its group, and that label is a promise about how the next verb will behave.

Summarising is what changes the grain

Collapsing to one row per group discards the detail underneath, so anything needed from it has to be computed inside the summary.

A count belongs beside every average, because an average over two rows and an average over four hundred look identical in the output.

Reading a chain forwards

Because grouping shows no visible effect where it is written, reading a chain means looking forwards from the grouping to find where its effect lands rather than looking for a change at that line.

The same habit explains the most common wrong chain in this part of the subject: averaging orders when the question asked about customers. Two collapses are needed there, customer within store and then store, and skipping the first answers a different question convincingly.

In this chapter

What this chapter covers

  • 01

    The pipe as a readable alternative to nested function calls

  • 02

    Grouping as a label that leaves the table looking untouched

  • 03

    Summarising as the step that changes the grain of the table

  • 04

    Carrying a count beside every average, and why it is not optional

  • 05

    Releasing the grouping so later steps do not run per group

Worked example · free

Following one table through grouping and summarising

Q [4 marks]. AskSia assigns four practice points to this independent exercise; they are not a University marking scheme. Twelve stores each carry a region and a quarterly sales figure. State the shape of the table at each stage and what the summary must carry.
  • 1State the shape of the starting table.
  • 1State the shape after grouping by region.
  • 1State the shape after summarising.
  • 1Name the column the summary must carry beside the average.
The starting table has twelve rows and three columns. After grouping by region it still has twelve rows and three columns in the same order; the only visible change is a note reporting that the table is grouped and how many groups it holds, and nothing has been calculated. After summarising it has one row per region, so if the twelve stores fall into three regions the table is three rows and the store-level detail is gone. The summary must carry the number of observations behind each group beside the average, because averages over very different numbers of rows look identical and mean different things.
Sia tip — If a later step returns a number computed over the wrong rows, check whether the grouping was released. A summarised table can arrive still carrying part of it.
Glossary

Key terms

Pipe operator
A connector that hands the result on its left into the opening slot of the function on its right.
Chaining
Writing several transformation steps in sequence so each one operates on the result of the previous.
Grouping
Attaching a label to every row saying which group it belongs to, without changing the rows themselves.
Grouped summary
A table reduced to one row per group, each carrying statistics computed over that group.
Share of total
A group's count divided by the sum of all counts, which is a new column on the summary rather than a second collapse.
FAQ

The Pipe and Grouped Business Summaries FAQ

Does grouping change the table?

Nothing visible changes. Row for row the table is what it was, in the order it was, holding the values it held, and the only difference is a label naming each row's group. What the label does is change how the next operation behaves, which is why its effect appears two lines later.

Why should a grouped summary always carry a count?

Because an average computed over two rows and one computed over four hundred are printed the same way. The count is the only column that tells the reader whether the figure is a solid result or a single unusual observation wearing the same clothes.

Why did a percentage column come back with only one row?

Because a summarising verb was used where a column-building step was needed. Turning counts into shares adds a column to an existing summary; summarising again collapses the table a second time and leaves a single row.

Study strategy

Exam move

Trace small tables through grouping and summarising on paper, writing the row and column count at each stage. The examination asks what comes back, and stating the shape is the fastest reliable route to that answer. When a chain confuses you, rewrite it one line at a time on paper and put the row and column count beside each line.

The line where those numbers move is the line doing the work, and it is nearly always the one the question is about.

Working through The Pipe and Grouped Business Summaries in CMCE10002? Sia is AskSia’s AI Statistics tutor — ask any CMCE10002 The Pipe and Grouped Business Summaries question and get a clear, step-by-step explanation grounded in how CMCE10002 is taught and assessed. Read this chapter free, then take your hardest questions to Sia.

A+Everything unlocked
Unlocks this Bible + all 74 of your The University of Melbourne subjects - and 1,000+ Bibles across every Australian university.
Sia - your CMCE10002 tutor, unlimited, worked the way the exam marks it
The full 5-page Bible + practice bank with worked solutions
Chrome extension - sync your LMS so Sia knows your deadlines
Bilingual EN / Chinese on every Bible and every Sia answer
$0.99 Trial
30-day money-back · cancel in one tap · how it works
Unlock the full CMCE10002 Bible + 74 The University of Melbourne subjects
$0.99 Trial