2
I have the data frame below, and I want to create a script to replace the NA
by the value of the top row of the same column.
DADOS <- data.frame(
a = c(1, 2, NA, 3, 4),
b = c(5, 6, 7, NA, NA)
)
Below the result as you would like:
DADOSRESULTADO <- data.frame(
a = c(1, 2, 2, 3, 4),
b = c(5, 6, 7, 7, 7)
)