rtidyversetidyquant

Combining multiple time series in tidyverse


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")


Solution

  • 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')