Is this what you want?
Note: If you have more questions not directly related to the one in your topic title, please ask them on a new topic.
library(dplyr)
homeruns_all <- data.frame(stringsAsFactors=FALSE,
Location = c("right center field", "left field", "left center field",
"right field", "right field"),
hit_distance_sc = c(409, 414, 421, 429, 389),
player_name = as.factor(c("Trevor Story", "Nolan Arenado", "Max Muncy",
"Anthony Rizzo", "Travis Shaw"))
)
dimensions <- data.frame(stringsAsFactors = FALSE,
Location = c("right center field", "right field", "center field",
"left field", "left center field"),
location_length = c(377, 328, 405, 375, 332))
homeruns_all %>%
left_join(dimensions, by = "Location") %>%
mutate(homerun = if_else(hit_distance_sc > location_length, 1, 0))
#> Location hit_distance_sc player_name location_length homerun
#> 1 right center field 409 Trevor Story 377 1
#> 2 left field 414 Nolan Arenado 375 1
#> 3 left center field 421 Max Muncy 332 1
#> 4 right field 429 Anthony Rizzo 328 1
#> 5 right field 389 Travis Shaw 328 1