You could use nested ifelse
:
col2 <- ifelse(col1==1, "G",
ifelse(col1==2, "H",
ifelse(col1==3, "J",
ifelse(col1==4, "K",
NA )))) # all other values map to NA
In this simple case it's overkill, but for more complicated ones...
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…