I have two data frames (df_a and df_b) both containing a number of columns and patient IDs. The columns contain information about particular diagnosis (TRUE or FALSE). My task is to combine the two data frames so that the value is TRUE if the value is TRUE in any of the data frames.
In reality there is a different number of rows in df_a and df_b. The matching should be done using the id. Both data frames have the same set of columns.
df_a <- data.frame(id = 1:10,
                 dg_a = c(T, T, T, F, F, F, T, T, F, T), 
                 dg_b = c(F, F, F, F, T, T, F, T, T, F))
df_b <- data.frame(id = 1:10, 
                 dg_a = c(F, F, F, T, F, F, F, T, T, T), 
                 dg_b = c(F, T, T, F, F, T, F, T, F, F))
I.e. after combining data frames df_a and df_b I should get df_c.
>df_c
   id  dg_a  dg_b
1   1  TRUE FALSE
2   2  TRUE  TRUE
3   3  TRUE  TRUE
4   4  TRUE FALSE
5   5 FALSE  TRUE
6   6 FALSE  TRUE
7   7  TRUE FALSE
8   8  TRUE  TRUE
9   9  TRUE  TRUE
10 10  TRUE FALSE
What is the best way of doing this in R? I have tried different types of joins but I can't quite figure it out.
 
     
     
    