我有一个字符向量中的URL列表,我想暂停查询之间的过程,因为如果不是x查询被拒绝.
urls=c('url1','url2','url3')
Run Code Online (Sandbox Code Playgroud)
这是我想做的
htmlpages=lapply(urls,function(x) readLines(x) Sys.sleep(0.3))
Run Code Online (Sandbox Code Playgroud)
正如贾斯汀所说,格式化是关键.
htmlpages = lapply(
urls,
function(x)
{
y <- readLines(x)
Sys.sleep(0.3)
y
}
)
Run Code Online (Sandbox Code Playgroud)