Using dplyr in R, I'm trying to add a new column based on the attributes of another column.  For example, I have a data frame with thousands of rows of state codes (like table1).  Now I want to add a new column called Region and assign the state codes to that region (like table2). How would that be done in dplyr?
table1 <- data.frame(State = c('NY','IL','CA','PA','FL','MI','AZ'))
table2 <- data.frame(State = c('NY','IL','CA','PA','FL','MI','AZ'),
                     Region = c('Northeast','Midwest','West','Northeast','Southeast','Midwest','West'))
 
     
    