The basic assignment was to create 2 columns (age & id) and figure out the id number of those old enough to drink. My professor said everything was correct except the bottom. I can find the ages of the people who can drink, but how can I determine and transmit their corresponding id number?
Thank you in advance.
id <- c(seq(1,30, by = 1)) #column id
age <- sample(12:60,30, replace = T) #column age
age_id <- cbind(age, id) #matrix of column id and column age
age_id
# NEED TO CORRECT THIS PART
ok_drink <- age_id
ok_drink [(age>20) & (id>20)]