From Stats Beerz on 2015-03-23. Here's the question: How can you substitute values in one column based on values in another column? There are many many ways. Here are a few,
Create some fake data:
d <- data.frame(
rel = c("yes", "no", "yes"),
troph = c(1, 2, 3))
d