PUPIL LABPurdue University · Research workshop
Data Manipulation, Visualization & Basic Analysis

How to use this course

Installing R and RStudio is optional, but we strongly encourage you to install both. You can also run the examples directly in this browser.

  1. Choose a lesson and read the example.
  2. Use Try in R Workspace, then Run. The browser automatically downloads R and the required packages on first use; keep this tab open while it prepares.
  3. Edit the code and run it again. No GitHub account or project download is needed.
  4. For AI help, review and copy your prepared question, open an external AI website, and paste it there. A separate AI account may be required.
  5. Download your script, plots or exported data if you want to keep them. The session and edits are temporary and reset when the page reloads or closes.

Use a current desktop browser and an internet connection. If preparation fails, check the connection and retry. Downloadable datasets and R examples are optional for studying outside this site.

PURDUE PART II + AI PRACTICE
Try this first
Check your reasoning
Read, try, and question · Purdue lesson
The editor contains the same R code shown below. Use Try in R Workspace beside any example. Printed outputs and figures are references; Run produces live results from your current data.
R workspaceR is not started

Ctrl/⌘ + Enter runs the selection, or the current line if nothing is selected. Ctrl/⌘ + Shift + Enter runs all. Select every line of a multiline command; incomplete selections produce R errors. Objects persist between runs. Download your edits before closing.

CONSOLE · CODE & LIVE R OUTPUT
Select Run R to start. The first run downloads R; later runs use the same session.

This opens the question builder below; it does not send data or generate an answer.

Environment preparation & file export

No desktop R installation is needed. The first data lesson downloads the real haven/readxl packages into this browser session. Preparation must finish before the lesson can run; a failed download is a setup issue, not an exercise error.

Restoring a data lesson reloads its sample and listed prerequisite objects. Other objects remain. Run does this once on entering a lesson, then preserves your changes within that lesson. Download files before closing; this session is temporary.

Export a file saved with write.csv(), write_sav(), or pdf():

A restart clears R objects and restores the supplied data. For a stuck run, Restart R terminates the worker; it does not preserve R objects.

Learn the method · use it beyond this workshop

AI Learning Assistant

Use prepared lesson guidance here, or build a focused question for a conversation on an external AI website.

A · On-page guided practice

One hint at a time

Prepared lesson guidance

These hints explain the selected lesson question. They do not interpret arbitrary edits or answer free-text questions. They are written in advance, not generated by AI.

Hint

Starter code may contain ____ for you to complete. Replacing the editor does not run code. Use Undo to recover your previous code.

What this guidance uses

B · Ask an external AI

Your question is prepared here. The AI answers on its own website. This page has no connected generative AI. Nothing is sent when you type or prepare a question.

1 · Identify your question

You can ask your own question. This text will be included as written; it will not be answered on this page.

2 · Choose relevant evidence

Review what you’ll share with AI

Nothing has been sent. These are the sources for your selected question; you can edit the final draft below.

Plot images are not included or interpreted. If your question depends on a plot, download it from the workspace and attach it on the AI website.

3 · Review and copy your question
GoalWhat am I trying to learn?EvidenceWhat did I use and observe?QuestionWhere am I stuck?HelpHow should AI support me?

Choose a question and evidence, then prepare a draft.

Before copying: Is the goal specific? Is the code the one you mean? Does the output come from that code? Have you stated what you need help understanding?

Your lesson questions and drafts stay while you move between lessons in this tab. Copy anything you want to keep before reloading or closing the page.

4 · Continue with an external AI

Each opens a separate website. Paste your copied question there to receive an AI response; sign-in may be required. These buttons do not transfer your code or question. Share only appropriate practice data.

5 · Bring the advice back. Run it. Check it.

A useful follow-up when the answer is unclear

“Your suggestion runs, but I do not yet understand [specific step]. Explain what it changes, why it is needed for my goal, and how I can check it before continuing. Please keep the approach understandable and explain any new package.”

AI advice is a proposal to inspect. Successful execution alone does not establish that the analysis answers your research question.

Workshop data & downloads

The original 200-case PISA teaching sample is included in three formats. Part II uses 197 observations after excluding 3 missing school-type values. These are demonstration data for practice.

CSVExcelSPSSAll R examples
VariableMeaning / coding
Stu_IDStudent identifier, not a continuous measurement
Gender1 = Female; 2 = Male, as coded in the source
Sch_Type1 = Private independent; 2 = Private Government-dependent; 3 = Public; 3 missing cases
Math_OverallOverall math score
Math_Reasoning
Math_Relation
Math_Quantity
Math domain scores supplied with the original handout

The default data lessons read the SPSS file with haven, preserving its labels and matching the original code. CSV is available as a separate download; it does not preserve SPSS label metadata. The teaching examples do not supply survey weights or the full PISA design. These small demonstration data support learning the syntax and workflow.