我尝试从此网址导入CSV文件,但这段简单的代码并不适用于此网址。
var myArray = ['1', '2' ....];
for (var i=1; i <= 5; i++)
{
var randomItem = myArray[Math.floor(Math.random()*myArray.length)];
console.log(randomItem );
}
我尝试从RCurl库中获取getURL,面临同样的问题。
答案 0 :(得分:1)
右键!只是忽略了它......
library(gdata)
read.xls("https://www.cboe.com/publish/vxthdata/vxth_dailydata.xls")
答案 1 :(得分:1)
正如MrFlick所说,您的文件是Excel文件,而不是CSV文件。
您可以使用readxl
和curl
。
url <- "https://www.cboe.com/publish/vxthdata/vxth_dailydata.xls"
destfile <- "vxth_dailydata.xls"
curl::curl_download(url, destfile)
vxth_dailydata <- readxl::read_excel(destfile, col_types = c("date", rep("numeric", 9)))
file.remove(destfile)
rm(url, destfile)
View(vxth_dailydata)
此致!!