There is a task: to sort through all the rows in the data table, and if the value in a certain column is greater than zero, and in the previous row it is equal to zero or NA, then assign this value to the previous row, and delete this row from the table. Sample code, but not working:
for(row in 1:nrow(merged))
{
if (merged$Ант.ок.пр[row] > 0 & is.null(merged$Ант.ок.пр[row-1]) | is.na(merged$Ант.ок.пр[row-1]))
{
merged$Ант.ок.пр[row-1] <- merged$Ант.ок.пр[row]
merged <- merged[-row, ]
}
}