The University of Manchester · FACULTY OF COMPUTER SCIENCE

SOST10031 Chap.2 Computational Thinking and R

- one subject, every graph, every model, every mark
8 Chapters4-page Bible
Our own words - no uploaded lecturer files
Updated for this semester
Chapter 2 of 10 · SOST10031

Computational Thinking and R

Computational Thinking and R covers how SOST10031 turns a question into ordered, checkable instructions. Computational thinking is presented as a way of reasoning rather than a software skill, built on five habits: decomposition, abstraction, sequencing, precision and checking.

The chapter follows the module's running example of comparing two participation rates for one country, first as plain steps, then as pseudocode, and then as supplied R code read aloud. Students learn what assignment, the pipe, filter and select do, why quotation marks and the double equals sign matter, and how comments explain the purpose of a step.

A central distinction separates R errors, which stop the code with a message, from analytical mistakes, which run smoothly and return a believable but wrong answer, such as selecting a row by its position. The chapter closes with the habit the portfolio relies on: make one small guided change, predict the new output, run it and check what should and should not have moved.

In this chapter

What this chapter covers

  • 01

    Five habits of computational thinking

  • 02

    Ordering a data task into checkable steps

  • 03

    Pseudocode as a plan written for people

  • 04

    Reading assignment, the pipe and filter aloud

  • 05

    Predicting output before running a line

  • 06

    R errors compared with analytical mistakes

  • 07

    Guided changes and what should stay fixed

  • 08

    Run, Source and Source with Echo in RStudio

Worked example · free

Turn a question into a checked plan from question to interpretation

Q [5 marks]. Using invented practice values, Country V records 62.0% of women and 71.5% of men aged 25 and over with at least some secondary education. Write the plan from question to interpretation, compute the gap, and state the check you would make before interpreting it. Treat the step weighting as AskSia's rehearsal aid, not something the University publishes.
The six boxes run from a plain-language question to an interpretation, and the dashed red path returns from the highlighted Check stage to Code, showing that anThe six boxes run from a plain-language question to an interpretation, and the dashed red path returns from the highlighted Check stage to Code, showing that an output only becomes an answer after it passes a check.QuestionPlanCodeOutputCheckInterpretfails check, revise codeoutput is not yet an answer
The six boxes run from a plain-language question to an interpretation, and the dashed red path returns from the highlighted Check stage to Code, showing that an output only becomes an answer after it passes a check.
  • 1Question: how far apart are the women's and men's secondary education shares in Country V?
  • 1Plan: open the file, keep the Country V row, take the two education columns, subtract women's from men's.
  • 1Output: 71.5 minus 62.0 equals 9.5.
  • 1Check: exactly one row was kept, its country reads Country V, both values are present and the order was men minus women.
  • 1Interpret: men's share is 9.5 percentage points higher; attainment means reaching some secondary schooling, not completing it.
The gap is 9.5 percentage points, men higher, reported only after confirming the selected row, both values and the subtraction order.
Sia tip — Put the check before the interpretation in your write-up; an unchecked output is not yet an answer.
Glossary

Key terms

Computational thinking
Expressing a problem as clear steps that a person or a computer can follow consistently.
Decomposition
Splitting a large question into smaller tasks that can each be solved and checked.
Pseudocode
A step-by-step plan written in code-like language for people rather than for R.
Pipe operator
The symbol |> that passes the result of one step into the next, read aloud as and then.
Analytical mistake
An instruction that runs without an error yet answers a different question from the one intended.
FAQ

Computational Thinking and R FAQ

Do I need to write R code from scratch?

No. Students read supplied code, explain each instruction in ordinary language, predict its output and make small guided changes. The portfolio likewise works from a supplied Quarto analysis rather than asking for an analysis built independently.

Why is selecting the second row a problem if the result looks real?

Positions in a table shift when data are sorted or refreshed, so a row number may point to a different country later. Filtering on the country name records the intention explicitly and lets a reader verify it.

What should I do when R shows an error message?

Read the whole message, locate the line it names, then compare spellings, quotation marks and brackets. Keep a record of what you tried and the exact text, because a tutor needs that detail to help quickly.

What is the difference between Run and Source with Echo?

Run executes the current line or a highlighted selection, which suits stepping through slowly. Source with Echo executes the entire script and displays every instruction alongside its result in the Console, so the full workflow can be followed.

Study strategy

Assessment move

Work with a supplied script open beside a notebook page. For each line, write in plain words what goes in, what instruction is performed and what should come out, then predict the printed result before running it. Record every mismatch and classify it as an R error or an analytical mistake, noting the clue that revealed it.

Practise the six-step plan on two or three invented questions, writing pseudocode first and only then matching each line to a function such as filter or select. Rehearse a guided change by swapping one input, listing what should change and what should stay the same, and confirming both. Read the assigned workflow chapter of R for Data Science on objects, comments and functions.

To close, explain one line of code aloud to a classmate; if you cannot, return to it before the seminar.

Working through Computational Thinking and R in SOST10031? Sia is AskSia’s AI Computer Science tutor — ask any SOST10031 Computational Thinking and R question and get a clear, step-by-step explanation grounded in how SOST10031 is taught and assessed. Read this chapter free, then take your hardest questions to Sia.

A+Everything unlocked
Unlocks this Bible + all 41 of your subjects at The University of Manchester, plus 1,000+ more Bibles across the AskSia library.
Sia - your SOST10031 tutor, unlimited, worked the way the exam marks it
The full 4-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