title: Retrieve monthly Adjusted stock quotes using the quantmod package in R
body: <p>I'm learning R this semester and this is my first assignment. I want to retrieve monthly Adjusted stock quotes within a set date range using a for loop. And once I am able to do that I want to merge all the data into a data frame.</p>
  
  <p>My code so far retrieves daily stock quotes for 5 stock symbols within a set date range, it assigns the object to the environment specified, and places only the .Adjusted column in the list.</p>
  
  <p>Could someone point me in a better direction in obtaining the monthly quotes and am I on the right track with my code. </p>
  
  <p>Thanks.   </p>
  
  <pre><code>#Packages
  library(quantmod)
  
  #Data structure that contains stock quote objects
  ETF_Data &lt;- new.env()
  
  #Assign dates to set range for stock quotes
  sDate &lt;- as.Date("2007-08-31")
  eDate &lt;- as.Date("2014-09-04")
  
  #Assign a vector of ticker symbols.
  ticker_symbol &lt;- c("IVW","JKE","QQQ","SPYG","VUG")
  
  #Assign number of ticker symbols.
  total_ticker_symbols &lt;- length(ticker_symbol)
  
  #Assign empty list to for each object contained in my environment. 
  Temp_ETF_Data &lt;- list()
  
  #Assign integer value to counter.
  counter &lt;- 1L
  
  #Loop and retrieve each ticker symbols quotes from Yahoo's API 
  for(i in ticker_symbol)  
  {  
  
    getSymbols(
      i, 
      env = ETF_Data, 
      reload.Symbols = FALSE, 
      from = sDate, 
      to = eDate,
      verbose = FALSE,
      warnings = TRUE,
      src = "yahoo",
      symbol.lookup = TRUE) 
  
    #Add only Adjusted Closing Prices for each stock or object into list. 
    Temp_ETF_Data[[i]] &lt;- Ad(ETF_Data[[i]])  
  
    if (counter == length(ticker_symbol))
    { 
       #Merge all the objects of the list into one object. 
       ETF_Adj_Daily_Quotes   &lt;- do.call(merge, Temp_ETF_Data)
       ETF_Adj_Monthly_Quotes &lt;- ETF_Adj_Daily_Quotes[endpoints(ETF_Adj_Daily_Quotes,'months')]
    }
    else
    {
      counter &lt;- counter + 1
    }
  
  }
  </code></pre>