For my R program I would like to replace empty values in a dataframe with the value at the same position in another dataframe. For instance:
A<- data.frame(matrix(ncol = 5, nrow = 2))
A[1,] <- c(1,NA,2,2,4)
A[2,] <- c(1,NA,NA,2,4)
B<- data.frame(matrix(ncol = 5, nrow = 2))
B[1,] <- c(2,3,4,2,4)
B[2,] <- c(1,4,7,2,9)
The new dataframe should then be:
A_updated<- data.frame(matrix(ncol = 5, nrow = 2))
A_updated[1,]<-c(c(1,3,2,2,4)
A_updated[2,]<-c(c(1,4,7,2,4)
Is this possible and if so, could somebody help me.
Many thanks in advance