[R-pkg-devel] NOTE about use of `:::`

Bill Dunlap w||||@mwdun|@p @end|ng |rom gm@||@com
Thu Dec 15 02:39:53 CET 2022


You could add an 'envir' argument to parse_args() and do your eval(...,
envir=envir) stuff inside parse_args().  Then change
  call[[1]] <- quote(pense:::parse_args)
  args <- eval.parent(call)
to
   call[[1]] <- quote(parse_args)
   call$envir <- parent.frame()
   args <- eval(call)
[That code is completely untested.]

-Bill

On Wed, Dec 14, 2022 at 3:19 PM David Kepplinger <david.kepplinger using gmail.com>
wrote:

> Dear List,
>
> I am working on updating the pense package and refactored some of the
> methods. I have several functions which take the same arguments, hence I'm
> sending all these arguments to an internal function, called `parse_args()`.
> Since I want to evaluate the arguments in the caller's environment, I'm
> using the following code
>
>   call <- match.call(expand.dots = TRUE)
>   call[[1]] <- quote(pense:::parse_args)
>   args <- eval.parent(call)
>
> Of course, R CMD CHECK complains about the use of `:::`, as it's almost
> never needed. I think the above usage would fall into that area of
> "almost", but I'm not sure if (a) there's a better approach and (b) the
> CRAN team would agree with me. I would have to test (b) by submitting and
> working with the CRAN team, but I wanted to ask the list first to see if
> I'm missing something obvious. I don't want to export the function
> parse_args() as it's not useful for a user, and the use is truly internal.
>
> Thanks and all the best,
> David
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-package-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel
>

	[[alternative HTML version deleted]]



More information about the R-package-devel mailing list