0
我有一段简单的R代码,它从一个网站读取html数据,然后我尝试遍历页面并从每个页面获取数据。我已经无数次地使用了这段代码,它很有用。它将来自每个页面的结果添加到R变量中,但由于某种原因,它不能工作。有任何想法吗?R函数将不会修改全局变量
library(XML)
library(RCurl)
data <- NULL
getData <- function(url) {
#For some reason cant read directly from site, need to use RCurl to get the data first
xData <- getURL(url)
table <- data.frame(readHTMLTable(xData)$'NULL')
data <- table
}
getData(url="https://steemdb.com/accounts/reputation?page=1")
X < - 的getData(URL =“https://steemdb.com/accounts/reputation?page = 1“) x包含数据。 – Indi
如何为函数添加'return(data)'?我不会建议混合全球环境和功能环境。 –