Introduction

This report analyzes the competition_horses.csv dataset, including summary statistics and visualizations.

Load Data

HOME = "~/LAB1"
df <- read.csv(file.path(HOME, "competition_horses.csv"))
head(df)
##   Horse_ID        Name Age         Breed Speed_kmh Competition_Wins
## 1     H001   Lightning   7 Quarter Horse     54.38               18
## 2     H002       Flash   5    Andalusian     62.66               17
## 3     H003     Cyclone   6      Friesian     45.79                0
## 4     H004 Solar Flare  14      Friesian     57.07               17
## 5     H005        Onyx   7 Quarter Horse     52.90               20
## 6     H006      Mirage  14 Quarter Horse     62.90                8
##        Trainer
## 1   John Smith
## 2  Lucas White
## 3   Liam Brown
## 4   Liam Brown
## 5   John Smith
## 6 Emma Johnson

Summary Statistics

summary(df)
##    Horse_ID             Name                Age           Breed          
##  Length:50          Length:50          Min.   : 3.00   Length:50         
##  Class :character   Class :character   1st Qu.: 5.00   Class :character  
##  Mode  :character   Mode  :character   Median : 8.00   Mode  :character  
##                                        Mean   : 8.78                     
##                                        3rd Qu.:12.75                     
##                                        Max.   :15.00                     
##    Speed_kmh     Competition_Wins   Trainer         
##  Min.   :45.03   Min.   : 0.00    Length:50         
##  1st Qu.:51.45   1st Qu.: 5.00    Class :character  
##  Median :55.62   Median :10.00    Mode  :character  
##  Mean   :55.91   Mean   :10.28                      
##  3rd Qu.:61.59   3rd Qu.:15.75                      
##  Max.   :64.97   Max.   :20.00

Distribution of Horse Ages

hist(df$Age, breaks = 10, col = "blue", main = "Distribution of Horse Ages", xlab = "Age (years)", ylab = "Count")

Speed vs. Competition Wins

plot(df$Speed_kmh, df$Competition_Wins, col = "blue", pch = 19, 
     main = "Horse Speed vs. Competition Wins", 
     xlab = "Speed (km/h)", ylab = "Competition Wins")

Boxplot of Speed by Breed

boxplot(Speed_kmh ~ Breed, data = df, col = "lightblue", 
        main = "Speed Distribution by Breed", xlab = "Breed", ylab = "Speed (km/h)", las = 2)

Top 5 Horses by Wins

df[order(-df$Competition_Wins), ][1:5, ]
##    Horse_ID      Name Age         Breed Speed_kmh Competition_Wins      Trainer
## 5      H005      Onyx   7 Quarter Horse     52.90               20   John Smith
## 9      H009 Whirlwind   3    Andalusian     56.09               20 Emma Johnson
## 27     H027   Eclipse   5  Thoroughbred     55.38               20   Liam Brown
## 11     H011 Hurricane  14 Quarter Horse     64.87               19 Emma Johnson
## 38     H038 Firestorm  14  Thoroughbred     50.44               19  Lucas White

Conclusion