# The file used for data wrangling
collegeDistance <- read.csv("https://vincentarelbundock.github.io/Rdatasets/csv/AER/CollegeDistance.csv", header = TRUE)
highIncomeMale <- subset(collegeDistance,gender=="male" & income == "high")
# Displaying the summary of the data in the file
print("The summary of the highIncomeMale data frame is:")
## [1] "The summary of the highIncomeMale data frame is:"
summary(highIncomeMale)
## X gender ethnicity score
## Min. : 1 Length:679 Length:679 Min. :28.95
## 1st Qu.: 1118 Class :character Class :character 1st Qu.:48.06
## Median : 2374 Mode :character Mode :character Median :54.47
## Mean : 4427 Mean :53.72
## 3rd Qu.: 3583 3rd Qu.:60.15
## Max. :37710 Max. :70.56
## fcollege mcollege home urban
## Length:679 Length:679 Length:679 Length:679
## Class :character Class :character Class :character Class :character
## Mode :character Mode :character Mode :character Mode :character
##
##
##
## unemp wage distance tuition
## Min. : 1.400 Min. : 6.590 Min. : 0.000 Min. :0.2575
## 1st Qu.: 5.300 1st Qu.: 8.890 1st Qu.: 0.500 1st Qu.:0.4954
## Median : 6.600 Median : 9.730 Median : 1.000 Median :0.8891
## Mean : 7.219 Mean : 9.691 Mean : 1.484 Mean :0.8367
## 3rd Qu.: 8.200 3rd Qu.:10.280 3rd Qu.: 2.000 3rd Qu.:1.1524
## Max. :17.700 Max. :12.960 Max. :16.000 Max. :1.4042
## education income region
## Min. :12.00 Length:679 Length:679
## 1st Qu.:13.00 Class :character Class :character
## Median :15.00 Mode :character Mode :character
## Mean :14.34
## 3rd Qu.:16.00
## Max. :18.00
# Calculating and displaying the mean of the score of the highIncomeMale data frame
print("The mean for the score field is:")
## [1] "The mean for the score field is:"
mean(highIncomeMale$score)
## [1] 53.7225
# Calculating and displaying the mean of the education field of the highIncomeMale data frame
print("The mean for the education field is:")
## [1] "The mean for the education field is:"
mean(highIncomeMale$education)
## [1] 14.33873
# Calculating and displaying the median of the score field of the highIncomeMale data frame
print("The median for the score field is:")
## [1] "The median for the score field is:"
median(highIncomeMale$score)
## [1] 54.47
# Calculating and displaying the median of the education field of the highIncomeMale data frame
print("The median for the education field is:")
## [1] "The median for the education field is:"
median(highIncomeMale$education)
## [1] 15