David.
> sapply(integer(n), function(i) eval_tidy(expr), simplify = simplify)
> }
>
> doRep2 <- function(a, b) sapply(a, replicate2, b)
> doRep2(3, 2)
> #> [,1]
> #> [1,] 2
> #> [2,] 2
> #> [3,] 2
>
> Hadley
>
> On Sat, Feb 13, 2021 at 7:09 AM Gabor Grothendieck
> <ggrothendieck at gmail.com> wrote:
>> Currently replicate used within sapply within a function can fail
>> because it gets the environment for its second argument, which is
>> currently hard coded to be the parent frame, wrong. See this link for
>> a full example of how it goes wrong and how it could be made to work
>> if it were possible to pass an envir argument to it.
>>
>> https://stackoverflow.com/questions/66184446/sapplya-replicate-b-expression-no-longer-works-inside-a-function/66185079#66185079
>>
>> --
>> Statistics & Software Consulting
>> GKX Group, GKX Associates Inc.
>> tel: 1-877-GKX-GROUP
>> email: ggrothendieck at gmail.com
>>
>> ______________________________________________
>> R-devel at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
>
>