tidyquant icon indicating copy to clipboard operation
tidyquant copied to clipboard

importing data from other R objects

Open vapniks opened this issue 6 years ago • 3 comments

How do I import a timeseries that I have obtained elsewhere and stored in an R object (e.g. a dataframe) into a tidyquant tibble?

vapniks avatar Feb 28 '19 14:02 vapniks

Load it into your R session using whatever the best import method for the datafile you have (i.e. tidyr::read_csv() for csv files, or readRDS() if you've saved it as an R object). Once it's in R workspace as a dataframe just use tibble() on the object to convert from dataframe to tibble.

j-stone avatar Feb 28 '19 15:02 j-stone

is it then easy to do things such as convert strings to dates, change the periodicity and merge with another tidyquant tibble?

vapniks avatar Feb 28 '19 15:02 vapniks

Yes I would think so. A tibble class object is a tibble whether you've imported it yourself and converted it or whether it's the result of tq_get() or some other tq function

j-stone avatar Feb 28 '19 16:02 j-stone