0

I have two excel files that share some of the same columns and I'm hoping to merge them together to create one huge data frame in R by matching the columns up. It is very important I do this correctly, as I will be working with this data frame for a while. Below is some example code. In the code, ID would be the shared column and I would like the EndDate column to be added to the BatStart data frame based on the ID. Of course, I will be merging many more columns with much larger date frame than this.

ID <- c("1", "2", "3")
StartDate <- c("2021-06-08", "2021-06-12","2021-07-01")
BatStart <- data.frame(ID, StartDate) 

BatStart
  ID  StartDate
1  1 2021-06-08
2  2 2021-06-12
3  3 2021-07-01

ID <- c("1", "2", "3") 
EndDate <- c("2021-06-15","2021-06-25","2021-07-13")
BatEnd <- data.frame(ID, EndDate) 

BatEnd
  ID    EndDate
1  1 2021-06-15
2  2 2021-06-25
3  3 2021-07-13
Martin Gal
  • 14,910
  • 4
  • 18
  • 37

0 Answers0