Note that there are some explanatory texts on larger screens.

plurals
  1. POdownloading FRED data with quantmod: can dates be specified?
    primarykey
    data
    text
    <p>I am downloading data from FRED with the quantmod library (author Jeffrey A. Ryan). With YAHOO and GOOGLE data, I am able to set start and end dates. Can the same be done for FRED data? </p> <p>The help page does not list "from" and "to" as options of quandmod's getSymbols function, from which I'm inferring that it is not currently possible.</p> <p>Is there a way to set a range for the data to be downloaded or do I need to download the entire dataset and discard the data I don't need?</p> <p>Thanks for your help. Below the code that illustrates the context:</p> <p>The dates are ignored when downloading from FRED:</p> <pre><code># environment in which to store data data &lt;- new.env() # set dates date.start &lt;- "2000-01-01" date.end &lt;- "2012-12-31" # set tickers tickers &lt;- c("FEDFUNDS", "GDPPOT", "DGS10") # import data from FRED database library("quantmod") getSymbols( tickers , src = "FRED" # needed! , from = date.start # ignored , to = date.end # ignored , env = data , adjust = TRUE ) head(data$FEDFUNDS) head(data$FEDFUNDS) FEDFUNDS 1954-07-01 0.80 1954-08-01 1.22 1954-09-01 1.06 1954-10-01 0.85 1954-11-01 0.83 1954-12-01 1.28 </code></pre> <p><strong>EDIT: Solution</strong></p> <p>Thanks to <strong>GSee</strong>'s suggestion below, I am using the following code to subset the data to within the range of dates specified above:</p> <pre><code># subset data to within time range dtx &lt;- data$FEDFUNDS dtx[paste(date.start,date.end,sep="/")] </code></pre> <p>Here I extracted the xts data from the environment before acting upon it. My follow-up question explores alternatives.</p> <p><strong>Follow-Up Question</strong></p> <p>I have asked some follow-up questions there: <a href="https://stackoverflow.com/questions/15980985/get-xts-objects-from-within-an-environment">get xts objects from within an environment</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload