Skip to content
Prev 370047 / 398503 Next

Fill in empty cell in data.frame from previous value

Excellent Boris, thx ? this helps

From: Boris Steipe
Sent: June 25, 2017 11:23 AM
To: Christophe Elek
Cc: r-help at r-project.org
Subject: Re: [R] Fill in empty cell in data.frame from previous value

Run it through a loop. I assume the cell contents is NA (Not Available). Test for it with is.na(). Whenever that returns TRUE, replace the NA value with the value from the previous row.

Cheers,
B.