我想下载csv文件,除了提到"下载所有记录"在这个webpage的R。
url <- "https://www.bseindia.com/markets/equity/EQReports/StockPrcHistori.aspx?expandable=7&scripcode=530077&flag=sp&Submit=G"
temporaryFilePath <- tempfile()
download.file(url, destfile = temporaryFilePath, method="auto")
url.data <- read.csv(temporaryFilePath)
url.data
我使用rvest
,RCurl
和XML
尝试了一些不同的方法,但到目前为止还没有运气。
答案 0 :(得分:1)
如果您要获取财务数据,请尝试按照以下步骤操作。
#Install Packages
library(quantmod)
library(plyr)
##set the default source to your function
setDefaults(getSymbols, src='google')
##Choosing the argu,ents
##You must find the symbol in yahoo finance website
symbol <- "AAPL"
##Start Date
StartDate = as.Date("2018-01-31")
##End Date
EndDate = as.Date("2018-03-15")
##Getting your stock price
StockData <- getSymbols(symbol, from=StartDate, to=EndDate, auto.assign=F)
##After obtain the data, you can make some adjusts
colnames(StockData) <- c("Open", "High", "Low", "Close","Volume")