(警告,新手,慢慢学习R)
你好呀,
我正在尝试使用 R 从网站自动下载数据。该网站正在使用共享点,并且在询问(从 https 获取网站而不是 CSV 中的 aspx 下载)后,有人将我指向 RSelenium。
但在我需要接受协议之前(我正在使用 RSelenium 进行“点击”)代码在这里:
# Using RSelenium to save file
##Installing the package if needed
install.packages("RSelenium")
##Activating
library("RSelenium")
checkForServer()
startServer()
#I had to start the server manually!
remDr <- remoteDriver()
remDr
remDr$open()
#open website and accepting conditions
remDr$navigate("https://www.paoilandgasreporting.state.pa.us/publicreports/Modules/Welcome/Agreement.aspx")
AgreeButton<-remDr$findElement(using = 'id', value="MainContent_AgreeButton")
AgreeButton$highlightElement()
AgreeButton$clickElement()
remDr$navigate("https://www.paoilandgasreporting.state.pa.us/publicreports/Modules/Production/ProductionByCountyExport.aspx?UNCONVENTIONAL_ONLY=false&INC_HOME_USE_WELLS=true&INC_NON_PRODUCING_WELLS=true&PERIOD=15AUGU&COUNTY=ALLEGHENY")
我的问题是:我在 RSelenium 中找不到“将链接另存为”的命令
我想我需要找到这种类型的东西:
CSVurl<-remDr$navigate ("https://www.paoilandgasreporting.state.pa.us/publicreports/Modules/Production/ProductionByCountyExport.aspx?UNCONVENTIONAL_ONLY=false&INC_HOME_USE_WELLS=true&INC_NON_PRODUCING_WELLS=true&PERIOD=15AUGU&COUNTY=ALLEGHENY")remDr$navigate("https://www.paoilandgasreporting.state.pa.us/publicreports/Modules/Production/ProductionByCountyExport.aspx?UNCONVENTIONAL_ONLY=false&INC_HOME_USE_WELLS=true&INC_NON_PRODUCING_WELLS=true&PERIOD=15AUGU&COUNTY=ALLEGHENY")
CSVurl$saveLinkAs(fileName)
这存在吗?在 R 中有更好的方法来做到这一点吗?
提前致谢