How do you copy the string of an adjacent cell if a cell contains a specific string?
A simplified version of my data frame looks like this:
df <- data.frame(
BT1Sp = c("Pine","White Oak"),
BT1Diam = c(20,15),
BT2Sp = c("do","Black Oak"),
BT2Diam = c(22,12)
)
T.Sps <- c("Pine|White Oak|Black Oak")
How can I replace the string in the BT2Sp column with the string in the BT1Sp column, if the string in BT2Sp is 'do'?