I haven’t. A clue what I’m doing but
I need to replace NAs in a column in one dataset with info from the column in another dataset
I’m trying to help someone out and that’s their problem they need to solve
Has anyone got any idea what the solution might be
>Solution :
As you haven’t provided any of your data, here is a base solution which may or not work for you depending on your situation. Please put more effort into your question if you need something more complicated than this.
df1 <- data.frame(a = c(1, 2, 3, 5, NA, 9))
df2 <- data.frame(a = c(2, 4, 5, 7, 20, 2))
df1$a <- ifelse(is.na(df1$a), df2$a, df1$a)
df1
#> a
#> 1 1
#> 2 2
#> 3 3
#> 4 5
#> 5 20
#> 6 9