0

I have two datasets that are built in the following way: enter image description here

So as you can see, the data is on the same DATES, but in the first database the information is daily, and in the second one there are more than one row for each date. How can I match the two datasets so I could get on the larger dataset, the information from the first dataset? (so it would duplicate itself for the whole day) Thank you all very much!

  • `merge(df2, df1, by.x = "date", by.y = "Date", all.x = TRUE)` or `dplyr::left_join(df2, df1, by = c("date" = "Date")`. – Gregor Thomas Feb 21 '20 at 15:09
  • Hi, thank you for the quick comment! the pasted table comes out only in NA's! how can I fix that? – Shoshan Ben-Tzvi Feb 21 '20 at 15:31
  • Make sure both columns are the `Date` class (or `character` class), not `factor` or anything else. If you're still having trouble, make your question reproducible by sharing `dput(droplevels(df1[1:10, ]))` and `dput(droplevels(df2[1:10, ]))` so we can debug on your actual data. (Perhaps a different small subset than the first 10 rows, make sure there are some matches between the two tables) – Gregor Thomas Feb 21 '20 at 16:08

0 Answers0