Resting Heart Rate Analysis by Gender

For this assignment, you will be submitting a webpage with the requested analysis of the data. The html link (only) should be submitted through blackboard. The webpage should be created with RMarkdown and analysis self-contained (i.e. all data manipulation, analysis, plotting, etc. should be done within R). The code that was used should be included and displayed results throughout your webpage (echo=TRUE) and the complete code should also be included at the end of your webpage (eval=FALSE).

Specifically, consider the file normtemp.csv that contains measurements on the resting body temperature and resting heart rate of n=65 randomly sampled males (1) and n=65 randomly sampled females (2). This file may be downloaded directly into R using read.csv() with the following link.

Reading data

#reading dataset
health_data <- read.csv("https://raw.githubusercontent.com/tmatis12/datafiles/main/normtemp.csv")
#Filtering data
health_data$Sex <- as.factor(health_data$Sex)
Males <- health_data[health_data$Sex == 1, ] 
Males <- Males$Beats
Females <- health_data[health_data$Sex == 2, ]
Females <- Females$Beats

Male Analysis

This is the male data analysis

The Male Heart rate looks like normally distributed. The data looks like it follows a straight line for the normal probability plot. Also, the data fits well within the bell curve. Compared to the Females, the IQR and the standard deviation is lower with means that female heart beat rates are more variable.

# Instruction to get the mean, max, min, median and quarters.
summary(Males)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   58.00   70.00   73.00   73.37   78.00   86.00
#standard deviation
sd(Males)
## [1] 5.875184
#histogram, with color blue and labels
hist(Males, col= "blue",xlab = "Beats",main = "Male Heart Beats")

#normal probability plot
qqnorm(Males)

Female Analysis

This is the female data analysis

The Female Heart rate looks like normally distributed. The data looks like it follows a straight line for the normal probability plot. Also, the data fits well within the bell curve. Compared to the Males, the IQR and the standard deviation is higher with means that male heart beat rates are less variable.

# Instruction to get the mean, max, min, median and quarters.
summary(Females)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   57.00   68.00   76.00   74.15   80.00   89.00
#standard deviation
sd(Females)
## [1] 8.105227
#histogram, with color pink and labels
hist(Females, col= "pink",xlab = "Beats",main = "Female Heart Beats")

#normal probability plot
qqnorm(Females)

Box Plots for Males and Females

Compared to the Males, the IQR and the standard deviation is higher with means that male heart beat rates are less variable.

Female has a higher mean, standard deviation, and IQR.

#box plot with labels
boxplot(Males,Females, names = c('Males' , "Females"),xlab = "Beats", main = "Male/Female")

Code without Evaluating

health_data <- read.csv("https://raw.githubusercontent.com/tmatis12/datafiles/main/normtemp.csv")
health_data$Sex <- as.factor(health_data$Sex)
Gender <- health_data$Sex
Males <- health_data[health_data$Sex == 1, ] 
Females <- health_data[health_data$Sex == 2, ]
summary(Males$Beats)
sd(Males$Beats)
hist(Males$Beats, col= "blue",xlab = "Beats",main = "Male Heart Beats")
qqnorm(Males$Beats)
summary(Females$Beats)
sd(Females$Beats)
hist(Females$Beats, col= "pink",xlab = "Beats",main = "Female Heart Beats")
qqnorm(Females$Beats)
boxplot(Males$Beats,Females$Beats, names = c('Males' , "Females"),xlab = "Beats", main = "Male/Female")