2

What is the tidyverse equivalent of 'merge'? Trying to do a small project in tidyverse... combining several time series into one by 'date':

t3 <- tq_get("DGS3", get = 'economic.data', from='1900-01-01')
t5 <- tq_get("DGS5", get = 'economic.data', from='1900-01-01')
t10 <- tq_get("DGS10", get = 'economic.data', from='1900-01-01')
t30 <- tq_get("DGS30", get = 'economic.data', from='1900-01-01')

?? data <- full_join(t3, *** all above, by = "date")

ShaunC
  • 23
  • 3
  • place it in a `list` and do the `full_join` i.e. `list(t3, t4, t10, t30) %>% reduce(full_join, by = 'date')` – akrun Feb 04 '19 at 16:04
  • 1
    Thank you! I could not have figured that out with my current knowledge. – ShaunC Feb 04 '19 at 16:08

1 Answers1

2

One option is to place the objects in a list and then reduce the datasets to a single data with full_join

library(tidyverse)
list(t3, t4, t10, t30) %>% 
     reduce(full_join, by = 'date')
akrun
  • 874,273
  • 37
  • 540
  • 662