Week1-Assignment

Author

Tenzin Thakuri

Approach Deliverable

I’m planning to used kaggle’s Health and lifestyle dataset for my first week’s assignment.i.e. ,https://www.kaggle.com/datasets/mahdimashayekhi/health-and-lifestyle-dataset?select=health_activity_data.csv . Because I am interested in finding insights from health related data, I want to explore whether males or females are more health-conscious. Additionally, this dataset allows for numerous comparison between male and female health and lifestyle factors across a wide range of age groups. I plan to find these insights by writing R code to analyze the data and visualize the outputs using chart.

Data challenges that I anticipated are:

1.Data Cleaning: Finding missing or null values.

2.Finding relationship between different column variables in the dataset.

Code Base Deliverable

Introduction

I have chosen the article https://www.health.harvard.edu/heart-health/the-heart-disease-gender-gap from Harvard Health to analyze the dataset I selected from kaggle https://www.kaggle.com/datasets/mahdimashayekhi/health-and-lifestyle-dataset?select=health_activity_data.csv. The article states that the overall heart disease is lower in woman than in man.It also state that woman tends to develop heart problem at older age than man.

Body

Importing the dataset

I imported the kaggle’s health_activity_data.csv file into R using read.csv function.

library(tidyverse)
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr     1.2.0     ✔ readr     2.2.0
✔ forcats   1.0.1     ✔ stringr   1.6.0
✔ ggplot2   4.0.3     ✔ tibble    3.3.1
✔ lubridate 1.9.5     ✔ tidyr     1.3.2
✔ purrr     1.2.1     
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag()    masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
url <- "https://raw.githubusercontent.com/lhamo07/Data-607-Assignment/refs/heads/main/health_activity_data.csv"
healthData <- read.csv(
  file=url
)
glimpse(healthData)
Rows: 1,000
Columns: 16
$ ID                           <int> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13…
$ Age                          <int> 56, 69, 46, 32, 60, 25, 78, 38, 56, 75, 3…
$ Gender                       <chr> "Male", "Male", "Female", "Male", "Male",…
$ Height_cm                    <int> 164, 156, 158, 197, 157, 199, 172, 178, 1…
$ Weight_kg                    <int> 81, 82, 65, 87, 63, 85, 72, 115, 51, 114,…
$ BMI                          <dbl> 30.72, 20.86, 30.93, 31.19, 29.37, 31.14,…
$ Daily_Steps                  <int> 5134, 12803, 16408, 18420, 17351, 5131, 1…
$ Calories_Intake              <int> 1796, 1650, 1756, 2359, 2556, 3256, 2216,…
$ Hours_of_Sleep               <dbl> 8.6, 4.5, 4.3, 4.1, 5.1, 6.5, 9.6, 6.7, 5…
$ Heart_Rate                   <int> 102, 103, 74, 116, 111, 104, 95, 73, 95, …
$ Blood_Pressure               <chr> "137/72", "129/65", "127/68", "125/86", "…
$ Exercise_Hours_per_Week      <dbl> 8.1, 3.7, 3.2, 8.5, 8.5, 3.6, 8.3, 8.5, 4…
$ Smoker                       <chr> "No", "No", "Yes", "No", "Yes", "No", "Ye…
$ Alcohol_Consumption_per_Week <int> 7, 7, 0, 5, 8, 7, 2, 0, 1, 1, 6, 5, 1, 7,…
$ Diabetic                     <chr> "No", "No", "No", "No", "No", "No", "Yes"…
$ Heart_Disease                <chr> "No", "No", "No", "No", "No", "No", "No",…

Checking for missing values

Before analyzing the data, I checked whether it contains any missing values.

anyNA(healthData)
[1] FALSE

Removing unnecessary columns

I removed some columns that I felt were unnecessary for my analysis. Removing these unnecessary columns makes the dataset easier to work with.

healthData <- healthData[, !names(healthData) %in% c("ID", "Height_cm","Weight_kg","Daily_Steps","Calories_Intake","Hours_of_Sleep")]

Standardizing column names

I converted all column names to lowercase to follow a standardized naming convention in R.

names(healthData) <- tolower(names(healthData))

Comparing Heart Disease by Gender

I compared the number of males and females with heart disease in the dataset. This helps determine whether heart disease cases are more common among males or females. After analyzing my dataset,following table clearly shows heart disease is more common in male than female.

cat("Heart disease count in male vs female")
Heart disease count in male vs female
table(healthData$gender[healthData$heart_disease == "Yes"])

Female   Male 
    42     51 

Conclusion

From my analysis, I found that heart disease cases were slightly higher among men than women in this dataset. I can extend this analysis by exploring other health and lifestyle factors, such as smoking, alcohol consumption, and exercise, to better understand their relationship with heart disease.

Reference

OpenAI. (2026). ChatGPT (GPT-5.6 Luna) [Large language model]. https://chat.openai.com. Accessed September 6, 2026.