Using “…” and “replicate”

前端 未结 4 1021
庸人自扰
庸人自扰 2020-12-20 11:47

In the documentation of sapply and replicate there is a warning regarding using ...

Now, I can accept it as such, but would li

4条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-20 12:08

    If you look at the code for replicate:

    > replicate
    function (n, expr, simplify = TRUE) 
    sapply(integer(n), eval.parent(substitute(function(...) expr)), 
        simplify = simplify)
    
    

    You see that the function is evaluated in the parent frame, where the ... from your calling function no longer exists.

提交回复
热议问题