I have the following data.frame "A" in R:
ID |
---|
1 |
456 |
200 |
550 |
110 |
and the following data.frame "B" defined in R
ID | Interaction | Student | Date |
---|---|---|---|
1 | email_sent | Isabel Gauss | 10/20/2021 |
200 | email_sent | Jason Bin | 2/8/2021 |
550 | email_sent | Brad Pit | 10/20/2021 |
999 | email_sent | John Brad | 10/15/2023 |
255 | email_sent | Joe Sam | 10/20/2021 |
and the following data.frame "C" defined in R
ID | Interaction | Student | Date |
---|---|---|---|
1 | Event_attend | Isabel Gauss | 09/14/2021 |
200 | Event_attend | Jason Bin | 6/9/2021 |
550 | Event_attend | Brad Pit | 10/20/2023 |
999 | Event_attend | John Brad | 10/10/2022 |
255 | Event_attend | Joe Sam | 10/15/2021 |
I need to have the following output ordered by ID:
ID | Event_sent | Date_email | Email_attend | Date_attended |
---|---|---|---|---|
1 | Y | 10/20/2021 | Y | 09/14/2021 |
456 | N | Null | N | Null |
200 | Y | 2/8/2021 | Y | 6/9/2021 |
550 | Y | 10/20/2021 | Y | 10/20/2023 |
110 | N | Null | N | Null |
The following is not working properly:
merge <- merge(A, B, C, by.x = "ID", all.x = TRUE, sort = TRUE)