简体   繁体   中英

Current cell value in R

Using ifelse() statement if the condition does not hold I want to see the current cell value.

My attempt:

aghh.mrg1$whynoloan <- ifelse( is.na(aghh.mrg1$whynoloan) & (aghh.mrg1$haveloan==0 & aghh.mrg1$ifoloan==0 ),1, CURRENT.CELL.VALUE)

如果我正确理解了您的问题(由于缺乏信息而很难解决),您可以执行以下操作:

aghh.mrg1$whynoloan <- replace(aghh.mrg1$whynoloan, (is.na(aghh.mrg1$whynoloan) & (aghh.mrg1$haveloan == 0 & aghh.mrg1$ifoloan == 0)), 1)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM