# The file used for data wrangling
collegeDistance <- read.csv("https://vincentarelbundock.github.io/Rdatasets/csv/AER/CollegeDistance.csv", header = TRUE)
# Creating and displaying a subset of the columns and rows of the file. Below, I will display a subset of all males who have a high income.
highIncomeMale <- subset(collegeDistance,gender=="male" & income == "high",select=c(gender,income,wage))
# Adding a new column called "State" to my highIncomeMale data frame. Add the value "New York" to this column.
highIncomeMale$state <-"New York"
# Adding a new column called "city" to my highIncomeMale data frame. Add the value "Brooklyn" to this column.
highIncomeMale$city <-"Brooklyn"
#I will display the first twenty rows of the modified data frame subset
head(highIncomeMale,20)
## gender income wage state city
## 1 male high 8.09 New York Brooklyn
## 22 male high 7.04 New York Brooklyn
## 33 male high 8.85 New York Brooklyn
## 38 male high 8.09 New York Brooklyn
## 39 male high 8.09 New York Brooklyn
## 41 male high 8.09 New York Brooklyn
## 61 male high 8.09 New York Brooklyn
## 62 male high 8.09 New York Brooklyn
## 63 male high 8.09 New York Brooklyn
## 70 male high 7.04 New York Brooklyn
## 74 male high 7.04 New York Brooklyn
## 77 male high 8.09 New York Brooklyn
## 80 male high 8.09 New York Brooklyn
## 82 male high 8.09 New York Brooklyn
## 97 male high 8.09 New York Brooklyn
## 105 male high 7.69 New York Brooklyn
## 112 male high 8.09 New York Brooklyn
## 117 male high 7.69 New York Brooklyn
## 122 male high 8.85 New York Brooklyn
## 127 male high 8.09 New York Brooklyn