A base R option using ifelse
transform(
df,
B = ifelse(A>200,A,NA),
C = ifelse(A<=200,A,NA)
)
gives
A B C
1 250 250 NA
2 190 NA 190
3 100 NA 100
4 500 500 NA
5 400 400 NA
Data
df <- data.frame(A = c(250,190,100,500,400))
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…