Dear R-helpers,

I have a dataframe like this:

ID  X1  X2  X3  X4  X5  X6
49  1   1   1   0   NA  NA
50  1   1   1   1   NA  1

I would like to convert a missing value (NA) that follows a 0 (zero) or
another missing value (NA) into a 0 (zero).

So, the above lines would be converted to:

ID  X1  X2  X3  X4  X5  X6
49  1   1   1   0   0   0
50  1   1   1   1   NA  1

I have been struggling with this all morning, so any help you could provide
would be much appreciated.

Thank you!

Mark Na

	[[alternative HTML version deleted]]

