In very simple cases, you can create an intermediate object containing the row numbers, but in general, that won't work...
DF = data.frame(id = LETTERS[1:5], v = rep(0:1, 2:3))
w = which(DF$v == 0)
DF$v[w] <- NA
# reversible as...
DF$v[w] <- 0
To properly write the reversal line, you have to keep around the
w object and review the line that created it, which is probably not worth the rigmarole compared to simply rerunning the eariler lines to recreate the data.
Also, the philosophy behind tidyverse entails not overwriting your input data in the first place. See for example...
dplyr will never support in-place mutation of data. This is something I feel very strongly about.
--from the dplyr issue tracker
There are tools for tracking changes (e.g., with data.table), but general reversal for any modification is probably too hard a problem.