I am trying to code in r to find the corresponding runoff values , where , rainfall exceed certain threhold. Problem is that my for code , either take only one element , or does not store any iterations. I kept on getting error that argument length is >1 , only one lement is used It jsut keep on printing all values in the code , or just evalaute against last value. I want to test the condition row by row in the data frame
I have tried for loop , It has to be for loop as I cant just focus on built in function. Even If i change my values, it jsut keep on printing all values in the code
`
for(row in 1:nrow(post)){
 Rainfall <- post[row,"Runoff"]
 Date <- post[row, "Day"]
 if (Rainfall.m3[nrow(post)] > 1000){
 print(paste("on", Day,"runoff was",post$Runoff))
 }
 else
 {print("")
 }`}
}
Here is my Data
      Day OB.NO Rainfall.m3 Comulative.Rainfall   Runoff Comulative.Runoff Computed.Runoff Comulative.Computed
46  28-Dec    46      6177.3             88052.7 1567.000          8105.812       575.72436          8206.51164
47  13-Jan    47      3210.8             91263.5  376.650          8482.462       299.24656           8505.7582
48  19-Jan    48      1500.7             92764.2   96.156          8578.618       139.86524          8645.62344
49  20-Jan    49      1116.8             93881.0  293.412          8872.030       104.08576           8749.7092
50  23-Jan    50      1500.7             95381.7   78.744          8950.774       139.86524          8889.57444
51   5-Feb    51      3036.3             98418.0  192.096          9142.870       282.98316           9172.5576
52   6-Feb    52      1186.6             99604.6   31.164          9174.034       110.59112          9283.14872
53  12-Mar    53      1291.3            100895.9  128.172          9302.206       120.34916          9403.49788
54  20-Mar    54       802.7            101698.6  127.404          9429.610        74.81164          9478.30952
55  29-Mar    55       628.2            102326.8    8.226          9437.836        58.54824          9536.85776
56   9-Apr    56       732.9            103059.7   56.490          9494.326        68.30628          9605.16404
 
     
    