Assignment 2: Exploratory Data Analysis on an Open Clinical Cohort

Write and submit a standalone R script executing exploratory analysis, statistical summaries, and diagnostic visualizations on a multi-variable clinical cohort dataset.

Your First Clinical Data Pipeline

Now that you have mastered data frame indexing, missing value flags, and base plotting systems, it is time to perform a complete exploratory analysis. Instead of working with isolated vectors, you will build a reproducible data frame pipeline to audit a cohort study—a foundational requirement for any clinical bioinformatician.

The Challenge Scenario

You are auditing an open clinical dataset capturing patient biomarkers across distinct phenotypic groupings. Your task is to ingest this rectangular data matrix, inspect column data domains, split out the cohort by treatment criteria, and generate visual distribution plots to identify tracking trends or rogue outliers.

Script Pipeline Checklist

Remember to document each stage using explicit '#' comment breaks, utilize the standard '<-' assignment arrow, safely bypass missing vectors with 'na.rm = TRUE', and format all plot parameters with clean axis titles.

Practical Assignment

Instructions:
1. Open RStudio and create a new blank script file. Save it immediately as 'clinical_cohort_eda.R'.
2. Load the built-in clinical 'CO2' dataset using the command 'data(CO2)' to serve as your open clinical matrix proxy.
3. Write an inspection routine to print the column dimensions and column variable types directly to your screen (Hint: use 'str()' or 'summary()').
4. Slice out a sub-cohort data frame containing only the observations from the 'Quebec' origin location.
5. Calculate the mean and median values of the continuous biomarker variable column ('uptake') for this Quebec sub-cohort, ensuring any potentially missing indices are stripped cleanly via 'na.rm = TRUE'.
6. Generate a comparative, side-by-side boxplot displaying 'uptake' concentrations stratified by the categorical variable 'Treatment'. Fully customize your plot using 'main', 'xlab', and 'ylab' arguments.

Proof of Work: Execute your entire script. Your script is structured correctly if your console displays clean descriptive summaries and your graphics panel successfully renders a labeled boxplot tracking distribution variances across your stratified treatment groups.

Lesson Metadata

Duration: 45 mins
Module Scope: Bioinformatics Bootcamp 2026: Computational Thinking for Biomedical Research