A base R option using replace
transform(
df,
COL1 = replace(COL1, COL1 == "O.cuniculus" & COL2 < 50, "O.spatacus")
)
gives
COL1 COL2
1 C.lupus 10
2 C.lupus 20
3 C.famil 90
4 O.spatacus 30
5 O.cuniculus 70
6 O.spatacus 10
A data.table
option works in a similar manner
setDT(df)[COL1 == "O.cuniculus" & COL2 < 50, COL1 := "O.spatacus"]
such that
COL1 COL2
1: C.lupus 10
2: C.lupus 20
3: C.famil 90
4: O.spatacus 30
5: O.cuniculus 70
6: O.spatacus 10
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…