R多个函数套用 [英] R multiple functions into lapply
本文介绍了R多个函数套用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在字符向量中有一个网址列表,我想暂停之间的过程查询,因为如果没有,则x查询被拒绝.
I have a list of urls in a character vector and I want to pause the process between queries because if not the x queries is rejected.
urls=c('url1','url2','url3')
这是我想做的事情
htmlpages=lapply(urls,function(x) readLines(x) Sys.sleep(0.3))
推荐答案
正如贾斯汀建议的那样,格式化是关键.
As Justin suggested, formatting is the key.
htmlpages = lapply(
urls,
function(x)
{
y <- readLines(x)
Sys.sleep(0.3)
y
}
)
这篇关于R多个函数套用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文