qanda <- read.csv("selective_affinities.csv")
qanda_modified <- read.csv("selective_affinities_aftermodified.csv")
attach(qanda_modified)
par (mfrow = c (2,2))

# Histogram 1 - these comments break up the code
hist (Handspan, freq = TRUE, main = "Handspan - breaks every 0.5cm", 
      xlab = "handspan", ylab = "frequency",
      breaks = seq (floor (min (Handspan)), 
                    ceiling (max (Handspan)), 0.5))

# Histogram 2 - the word histogram has Greek components
hist (Handspan, freq = TRUE, main = "Handspan - integer breaks", 
      xlab = "handspan", ylab = "relative frequency / cm",
      breaks = seq (floor (min (Handspan)), 
                    ceiling (max (Handspan)), 1))

# plot 3 - correct to normal distribution
Handspan_mean <- mean(Handspan)
Handspan_var <- var(Handspan)

Handspan_values <- seq(0, 30, length.out = 1000)
plot(Handspan_values, dnorm(Handspan_values, mean = Handspan_mean, sd = sqrt(Handspan_var)), 
     type = "l", col = "blue", lwd = 2, 
     ylab = "Density", xlab = "Y")

detach(qanda_modified)

# the data is not normally distributed as either graph doesn't fit the third normal distribution plot