SOST10031 Chap.2 Computational Thinking and R
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.
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
- 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.
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.
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.
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.