First time asking a question (be gentle) since I haven't been able to find anything that works.
In R I have two data frames. One (DataFrameA) has a column with a list of unique dates. The other (DataFrameB) also has a list of dates. But some dates in DataFrameB may not exist in DataFrameA. When that is the case, I want to update the date in DataFrameB to the minimum date from DataFrameA that is greater than the date in DataFrameB.
In SQL I'd probably do something like this:
Select MyDate as OldDate,
(select min(MyDate) from DataFrameA where MyDate >= B.MyDate) as NewDate
from DataFrameB as B
My goal is to update the MyDate Column in each row of DataFrameB with the correct value from DataFrameA.
So if DataFrame B starts out with
2019-01-01
2019-01-02
2019-01-03
2019-01-04
2019-01-05
and DataFrameA only has
2019-01-01
2019-01-03
2019-01-05
DataFrameB will end up looking like
2019-01-01
2019-01-03
2019-01-03
2019-01-05
2019-01-05
Thanks in advance.