-1

I have to different datasets (A and B) and I want to do a calculation, which requires matching the datasets by date.

My problem is that there are some dates in A, which aren't included in B. Then I want to find the date in B closest to the date in A.

E.g: date in A is 2005-03-03 , but in B there is only available: 2005-03-02 and 2005-03-04. Now I want to match 2005-03-03 (A) with 2005-03-03 (B). How can I do this?

Thank you in advance!

Chrissss12
  • 21
  • 4
  • 1
    Check out rolling joins in data.table – SamR May 08 '22 at 10:29
  • Hi Chrissss12, Stack disincentivizes us from both answering a question and advising new users to be contributing members of the Stack community. As such, I'll advise: please consider going back to your [previous questions](https://stackoverflow.com/users/18000861/chrissss12?tab=questions) and accepting answers by clicking on the check-mark; this indicates to the wider community that you've found a solution and gives some reputation to both the answerer and yourself. There is no obligation to do this. (I hope somebody else answers your question, as now I cannot.) – r2evans May 08 '22 at 14:55
  • ... and please make this question reproducible, see https://stackoverflow.com/q/5963269, [mcve], and https://stackoverflow.com/tags/r/info – r2evans May 08 '22 at 14:56

0 Answers0