I have data as follows:
dat <- list(`A` = c(0, 25, 500, 1000, 0, 0), `B` = c(0,
25, 500, 1000, 1500, 0)
I would like to remove the last 0 if there are two 0's.
I am breaking my brain on how to achieve this but I cannot come up with anything.
How should I do this?
Desired output:
out_dat <- list(`A` = c(0, 25, 500, 1000, 0), `B` = c(0,
25, 500, 1000, 1500, 0)