read.csv("http://ichart.finance.yahoo.com/table.csv?s=SPY")无效 [英] read.csv("http://ichart.finance.yahoo.com/table.csv?s=SPY") Not Working

查看:92
本文介绍了read.csv("http://ichart.finance.yahoo.com/table.csv?s=SPY")无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用以下命令很长时间了,没问题:

I have been using the following command for a long time without problem:

spy <- read.csv("http://ichart.finance.yahoo.com/table.csv?s=SPY")

但是在过去的几天里,它开始引发以下错误:

But in the past few days it started to throw the following error:

警告消息:

Warning messages:

1:在file(file,"rt")中: 内部"方法无法处理https重定向到:' https://ichart.finance .yahoo.com/table.csv?s = SPY '

1: In file(file, "rt") : "internal" method cannot handle https redirection to: 'https://ichart.finance.yahoo.com/table.csv?s=SPY'

2:在file(file,"rt")中:"internal"方法失败,因此尝试使用"libcurl"

2: In file(file, "rt") : "internal" method failed, so trying "libcurl"

我已经将RStudio,R和所有软件包更新为今天的最新版本.有人可以帮我解决这个问题吗?

I've updated my RStudio, R and all packages to the most up-to-date versions as of today. Could someone help me resolve this issue?

提前谢谢!

推荐答案

错误消息中的修复程序就在那里:使用 https 而不是http:

The fix is right there in the error message: use https not http:

R> spy <- read.csv("https://ichart.finance.yahoo.com/table.csv?s=SPY")
R> head(spy)
        Date   Open   High    Low  Close   Volume Adj.Close
1 2017-04-19 234.52 234.95 233.18 233.44 66861500    233.44
2 2017-04-18 233.72 234.49 233.08 233.87 80188300    233.87
3 2017-04-17 233.11 234.57 232.88 234.57 63559500    234.57
4 2017-04-13 233.64 234.49 232.51 232.51 83019800    232.51
5 2017-04-12 234.74 234.96 233.77 234.03 76322100    234.03
6 2017-04-11 234.90 235.18 233.34 235.06 85727700    235.06
R> 

这篇关于read.csv("http://ichart.finance.yahoo.com/table.csv?s=SPY")无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆