read.table - downloaded data can't be read in R -


i getting errors whenever i'm using forms of getsymbols , get.hist.quote commands. error basically:

>getsymbols("aapl")  error in read.table(file = file, header = header, sep = sep, quote = quote, :    more columns column names  

another example:

    >x <- get.hist.quote(instrument = "^gspc", start = "1998-01-01", quote = "close")      trying url 'http://chart.yahoo.com/table.csv?s=^gspc&a=0&b=01&c=1998&d=4&e=12&f=2013&g=d&q=q&y=0&z=^gspc&x=.csv'      content type 'text/csv' length unknown      opened url      downloaded 230 kb   error in read.table(destfile, header = true, sep = ",", as.is = true,  :    more columns column names 

it happening sources , symbols. how fix it?? way same commands working fine on other computers. packages used: "quantmod" or "tseries"

after running debugger suggested in comments got:

> debugonce(read.table) > getsymbols("aapl")  browse[2]> head(readlines(file)) [1] "000fe47"                                                [2] "date,open,high,low,close,volume,adj close"              [3] "2013-05-13,451.51,457.90,451.50,454.74,11319600,454.74" [4] "2013-05-10,457.97,459.71,450.48,452.97,11948800,452.97" [5] "2013-05-09,459.81,463.00,455.58,456.77,14231700,456.77" [6] "2013-05-08,459.04,465.37,455.81,463.84,16878500,460.79" browse[2]> tail(readlines(file)) [1] "2007-01-05,85.77,86.20,84.40,85.05,29812200,83.26" [2] "2007-01-04,84.05,85.95,83.82,85.66,30259300,83.86" [3] "2007-01-03,86.29,86.58,81.90,83.80,44225700,82.04" [4] ""                                                  [5] "0"                                                 [6] ""                                                   browse[2]> q >  

thx question. can't reproduce error though. file downloads , read well.

my_file <- read.csv('http://chart.yahoo.com/table.csv s=^gspc&a=0&b=01&c=1998&d=4&e=12&f=2013&g=d&q=q&y=0&z=^gspc&x=.csv') 

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -