I need to put the value of variable "A" in place of the NA of variable "B".
Example of my dataframe:
> df <- data.frame(A = seq(1, 10), B = c(1, NA, 3, 4, NA, NA, 7, 8, NA, NA))
> df
    A  B
1   1  1
2   2 NA
3   3  3
4   4  4
5   5 NA
6   6 NA
7   7  7
8   8  8
9   9 NA
10 10 NA
I want the above dataframe converted into this:
> df
    A  B
1   1  1
2   2  2
3   3  3
4   4  4
5   5  5
6   6  6
7   7  7
8   8  8
9   9  9
10 10 10