2

i'm trying to retrieve AAPL financials and i'm getting the following error

> library(quantmod)
> f <- get(getFinancials('APPL'))
Error in thead[x]:thead[x + 1] : NA/NaN argument
In addition: Warning message:
In readLines(tmp) :
  incomplete final line found on 'C:\Users\myuser\AppData\Local\Temp\Rtmpgrg0Uq\fileafc7f52710a'

i've tried to load the entire NQ100 and got the same error message for these stocks as well

> symbols
 [1] "ADBE" "APOL" "AAPL" "AMAT" "ADSK" "ADP"  "BBBY" "BMC"  "CA"   "CERN" "CSCO" "COST" "DELL" "DTV"  "DLTR" "ERTS" "ESRX" "FFIV" "FLEX" "GRMN" "GMCR" "HSIC" "ILMN"
[24] "INFY" "INTC" "INTU" "JOYG" "KLAC" "LRCX" "LLTC" "MRVL" "MXIM" "MCHP" "MU"   "MSFT" "NTAP" "NWSA" "NVDA" "ORCL" "PAYX" "QCOM" "RIMM" "ROST" "SNDK" "STX"  "SHLD"
[47] "SPLS" "SBUX" "SYMC" "URBN" "VOD"  "WFM"  "XLNX"

all other stocks work fine

this is the text from the file fileafc7f52710a specified in the error message

<!DOCTYPE html><html><head><script>(function(){(function(){function d(a){this.t={};this.tick=function(a,c,b){b=void 0!=b?b:(new Date).getTime();this.t[a]=[b,c]};this.tick("start",null,a)}var a=new d;window.jstiming={Timer:d,load:a};if(window.performance&&window.performance.timing){var a=window.performance.timing,c=window.jstiming.load,b=a.navigationStart,a=a.responseStart;0<b&&a>=b&&(c.tick("_wtsrt",void 0,b),c.tick("wtsrt_","_wtsrt",a),c.tick("tbsd_","wtsrt_"))}try{a=null,window.chrome&&window.chrome.csi&&(a=Math.floor(window.chrome.csi().pageT),
c&&0<b&&(c.tick("_tbnd",void 0,window.chrome.csi().startE),c.tick("tbnd_","_tbnd",b))),null==a&&window.gtbExternal&&(a=window.gtbExternal.pageT()),null==a&&window.external&&(a=window.external.pageT,c&&0<b&&(c.tick("_tbnd",void 0,window.external.startE),c.tick("tbnd_","_tbnd",b))),a&&(window.jstiming.pt=a)}catch(e){}})();})();
</script><title>Financial Statements for APPELL PETE CORP - Google Finance</title><meta name="Description" content="Get the detailed quarterly/annual income statement, cashflow statement, and balance sheet for APPELL PETE CORP (PINK:APPL). See revenue, expenses, profit, cash, assets, liabilities, shareholder’s equity and more for the lastest fiscal quarter/year for APPELL PETE CORP (PINK:APPL) on Google Finance."><meta http-equiv="X-UA-Compatible" content="IE=10"><link rel="stylesheet" type="text/css" href="/finance/f/finance_us-3578168175.css"><link rel="stylesheet" type="text/css" href="/finance/_/ss/a/ver=1b0b1eb0rwwhe/am=!xiAxGGlQxoffym1L/bf=/r=O"><link rel="icon" type="image/vnd.microsoft.icon" href="/finance/favicon.ico"><style>#gbar,#guser{font-size:13px;padding-right:8px;padding-top:4px !important;}#gbar{padding-left:8px;height:22px}#guser{padding-bottom:7px !important;text-align:right}.gbh,.gbd{border-top:1px solid #c9d7f1;font-size:1px}.gbh{height:0;position:absolute;top:24px;width:100%}@media all{.gb1{height:22;margin-right:.5em;vertical-align:top}#gbar{float:left}}a.gb1,a.gb4{text-decoration:underline !important}a.gb1,a.gb4{color:#00c !important}.gbi .gb4{color:#dd8e27 !important}.gbf .gb4{color:#900 !important}</style><script></script><script>
      function _rpt() {}
      function _tck() {}
    </script></head><body><div class=fjfe-bodywrapper><div id=fjfe-real-body class=g-doc><input type="text" name="hist_state" id="hist_state" style="display:none;"><iframe id="hist_frame" name="hist_frame" class=invfr tabindex="-1"></iframe><iframe src="/finance/_/js/a/b/rt=h/ver=t5fUYABu0to.en_US./sv=1/am=!xiAxGGlQxoffym1L/d=0" class=invfr tabindex="-1"></iframe><div id=gbar><nobr><a class=gb1 href="http://www.google.com/webhp?hl=en&tab=ew">Search</a> <a class=gb1 href="http://www.google.com/imghp?hl=en&tab=ei">Images</a> <a class=gb1 href="http://maps.google.com/maps?hl=en&tab=el">Maps</a> <a class=gb1 href="https://play.google.com/?hl=en&tab=e8">Play</a> <a class=gb1 href="http://www.youtube.com/?tab=e1">YouTube</a> <a class=gb1 href="http://news.google.com/nwshp?hl=en&tab=en">News</a> <a class=gb1 href="https://mail.google.com/mail/?tab=em">Gmail</a> <a class=gb1 href="https://drive.google.com/?tab=eo">Drive</a> <a class=gb1 style="text-decoration:none" href="http://www.google.com/intl/en/options/"><u>More</u> &raquo;</a></nobr></div><div id=guser width=100%><nobr><span id=gbn class=gbi></span><span id=gbf class=gbf></span><span id=gbe></span><a  href="http://www.google.com/support/finance?hl=en" class=gb4>Help</a> | <a target=_top id=gb_70 href="https://www.google.com/accounts/ServiceLogin?service=finance&passive=1209600&continue=http://www.google.com/finance?fstype%3Dii%26q%3DAPPL&followup=http://www.google.com/finance?fstype%3Dii%26q%3DAPPL" class=gb4>Sign in</a></nobr></div><div class=gbh style=left:0></div><div class=gbh style=right:0></div><div id=fjfe-click-wrapper><script>
(function() {
  var l = window.location;
  var q = l.search ? l.search.substr(1) : '';
  var h = l.hash ? l.hash.substr(1) : '';
  var p = '/finance';
  var ss = 'stockscreener';
  var conn = window.history && window.history.pushState ? '/' : '#';
  if (l.pathname == p + '/' + ss) {
    if (h) l.href = p + conn + ss + '?' + q + '&' + h;
  } else if (l.pathname != p && h) {
    l.href = p + l.hash;
  }
  if (h) {
document.getElementById('fjfe-click-wrapper').style.display = 'none';
  }
})();
</script><div id=gf-head class="g-section g-tpl-75-25 g-split"><div class="g-unit g-first"><div class=fjfe-logo><a href="/finance/?ei=OudPUfCPNIeowAPQtQE"><img src="/finance/f/logo_us-115376669.gif" alt="Google Finance"></a></div><div id=gf-search class=fjfe-search><form method="get" action="/finance" autocomplete="off"><input class=fjfe-searchbox-input name=q type=text tabindex=1 value="PINK:APPL"></input><span class=fjfe-searchbox-button-wrapper><span class=fjfe-searchbox-button-wrapper2><input class=fjfe-searchbox-button type=submit tabindex=2 value="Get quotes"></input></span></span><input type=hidden name="ei" value="OudPUfCPNIeowAPQtQE"></input></form></div></div><div class="g-unit fjfe-promo"><div id="ad2-target" class="id-ad2-target"></div></div></div><div class=elastic><div id=app class="g-section g-tpl-left-11p4em"><div class="g-unit g-first"><div id=gf-nav><div class=fjfe-nav-nav><ul class=fjfe-nav id=navmenu><li class=fjfe-nav-item><a href="/finance?ei=OudPUfCPNIeowAPQtQE"><div>Markets</div></a><li class=fjfe-nav-item><a href="/finance/market_news?ei=OudPUfCPNIeowAPQtQE"><div>News</div></a><li class=fjfe-nav-item><a href="/finance/portfolio?action=view&ei=OudPUfCPNIeowAPQtQE"><div>Portfolios</div></a></ul></div><div class="fjfe-recentquotes fjfe-recentquotes-noquote"><h4>Recent Quotes <span class="fjfe-recentquotes-duration">(2 hours)</span></h4><div class=fjfe-recentquotes-noquote-notification>You have no recent quotes</div><div class=fjfe-recentquotes-quotes><div class="fjfe-toggle fjfe-toggle-button"><span class=fjfe-chg-toggle>chg</span> | <span class=fjfe-perc-toggle>%</span></div><div class=fjfe-table-div><table class=fjfe-recentquotes-table id=rq width=100%></table></div></div></div></div><script>var _cleardot = 'data:image/gif;base64,R0lGODlhAQABAIAAAP///////yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==';
    var google = google || {};
    google.finance = google.finance || {};
    google.finance.gce =false;</script><script src="/finance/f/sfe-opt-2862241303.js"></script><script>
      _regOnLoad = function(f) {
        if (document.readyState == 'complete') {
          f && f();
        } else {
          // Window.attachEvent() for IE8 and below compatability.
          var addEventFunction = window.attachEvent ||
              window.addEventListener || function(ignored, f) { f(); };
          var event = window.attachEvent ? 'onload' : 'load';
          f && addEventFunction(event, f);
        }
      };

      google.finance.renderRecentQuotes = function() {};
    </script></div><div class=g-unit id=gf-viewc><div class=fjfe-content></div></div></div></div></div><div id=gf-foot><div class=fjfe-footer-links>Google Finance Beta available in: <a href="http://www.google.com.hk/finance?ei=OudPUfCPNIeowAPQtQE" class="fjfe-edition-link">Hong Kong</a> - <a href="http://www.google.ca/finance?ei=OudPUfCPNIeowAPQtQE" class="fjfe-edition-link">Canada</a> - <a href="http://www.google.com/finance?ei=OudPUfCPNIeowAPQtQE" class="fjfe-edition-link">U.S.</a> - <a href="http://www.google.com.hk/finance?hl=zh-CN&ei=OudPUfCPNIeowAPQtQE" class="fjfe-edition-link">China</a> - <a href="http://www.google.co.uk/finance?ei=OudPUfCPNIeowAPQtQE" class="fjfe-edition-link">U.K.</a></div><p class=fjfe-footer-disclaimer>Information is provided "as is" and solely for informational purposes, not for trading purposes or advice, and may be delayed.<br>To see all exchange delays, please <a href="http://www.google.com/intl/en/googlefinance/disclaimer/?ei=OudPUfCPNIeowAPQtQE" class="fjfe-secondary-link fjfe-no-sticky-params"> see disclaimer</a>.</p><div class=fjfe-footer-links>&copy;2013 Google - <a href="http://www.google.com?hl=en&ei=OudPUfCPNIeowAPQtQE">Google Home</a> - <a href="http://googlefinanceblog.blogspot.com?ei=OudPUfCPNIeowAPQtQE">Blog</a> - <a href="http://support.google.com/finance?hl=en&ei=OudPUfCPNIeowAPQtQE">Help</a> - <a href="http://support.google.com/finance?ctx=report&hl=en&ei=OudPUfCPNIeowAPQtQE&exch=PINK&sym=APPL">Report a Problem</a> - <a href="http://www.google.com/intl/en/policies/privacy/?ei=OudPUfCPNIeowAPQtQE">Privacy Policy</a> - <a href="http://www.google.com/intl/en/policies/terms/?ei=OudPUfCPNIeowAPQtQE">Terms of Service</a></div></div></div></div><script>var googlefinance = {i: ["f.b.id","",,500,"",0,,["f.b.cf","t5fUYABu0to.en_US.",0]
,[]
,0,[["c388b5b8","true",2]
]
,"OudPUfCPNIeowAPQtQE","www.google.com"]
}; GF_domReady = 1;</script></body></html>
4
  • It seemss that getFinancials function is bit flaky. I got error first time I ran getFinancials('AAPL') but error was gone when I ran it again.
    – CHP
    Mar 25, 2013 at 6:23
  • i've tried running it again just now and i get Warning message: In readLines(tmp) : incomplete final line found on 'C:\Users\mbenita\AppData\Local\Temp\Rtmpgrg0Uq\fileafca934b2f'. is there an alternative ? maybe a different data source .... ?
    – haki
    Mar 25, 2013 at 6:35
  • you can ignore that warning. Not sure if is there any other datasource
    – CHP
    Mar 25, 2013 at 6:38
  • I tried running the source line by line (from the point where tmp is assigned, having it point to the file), and it worked just fine. But when I tried to run getFinancials('APPL') got the same error as you Mar 25, 2013 at 6:56

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.