私のデータフレーム:
Dead4 Dead5
0 0
0 0
0 0
1 2
0 0
0 0
1 2
0 0
1 0
0 1
1 1
5 10
同じ行で Dead5 が Dead4 よりも大きいときはいつでも、コードで 2 つの値を減算し、その値を Dead5 に配置します。
indices<- (t$Dead5 > t$Dead4)
t$Dead6[indices]<- (t$Dead6) - (t$Dead5)
Warning message:
In t$Dead6[indices] <- (t$Dead6) - (t$Dead5) :
number of items to replace is not a multiple of replacement length
私が間違っていることを説明し、これを行う数行のコードを書くのを手伝ってくれる人はいますか?