作為基礎函數,do.call的作用可以簡單總結為:對 列表 中的每壹項進行某個函數操作(rbind,cbind,sum,paste等)。簡單的講,do.call 的功能就是執行壹個函數,而這個函數的參數呢,放在壹個list裏面, 是list的每個子元素。
Description
do.call constructs and executes a function call from a name or a function and a list of arguments to be passed to it.
Usage
do.call(what, args, quote = FALSE, envir = parent.frame())
quote
a logical value indicating whether to quote the arguments.
envir
an environment within which to evaluate the call. This will be most useful if what is a character string and the arguments are symbols or quoted expressions.
Details
If quote is FALSE, the default, then the arguments are evaluated (in the calling environment, not in envir). If quote is TRUE then each argument is quoted (see quote) so that the effect of argument evaluation is to remove the quotes – leaving the original arguments unevaluated when the call is constructed.
do.cal類似壹個循環,對list中每個對象進行函數操作 ,類似的還有函數還有apply家族的函數,待有時間分享壹下學習經過。