This repository converts an interactive R console transcript into a clean, runnable script that demonstrates core R skills and exploratory data analysis (EDA). It also includes a PDF for a related analytics project: predicting second heart attack risk.
lab1_analysis.R— cleaned and commented R script covering:- Reading data with
read.table - Inspecting with
head,tail,summary - Subsetting columns and computing
cor - Working with vectors, factors, lists, matrices, and tables
- Defining simple helper functions (
std,tellme) - Saving intermediate objects to
data/Labs.RData
- Reading data with
docs/Second_Heart_Attack_Risk_Analysis.pdf— PDF
- Place
lab1_01.txtandlab1_02.txtin thedata/folder. - Open R/RStudio and set your working directory to the project root (or use RStudio Projects).
- Run:
Outputs (summaries, tables, correlations) will print in the console. A
source("lab1_analysis.R")data/Labs.RDatafile will be created.
- Data wrangling & EDA
- Understanding R data structures (vectors, factors, lists, matrices, tables, data frames)
- Writing reusable helper functions
- Reproducible project structure & relative paths
- R, RStudio
- The script uses relative paths (no hard-coded
setwd()), so it runs from the project root. - Original data is not included. Add your own copies to
data/.
Exercises inspired by:
- Data Science and Big Data Analytics (EMC Education Services).