Re: [Rd] Lazy-evaluate elements wrapped with invisible

2022-10-28 Thread Dipterix Wang
> This is not quite true. The value, even when invisible, is captured by > .Last.value, and > > > f <- function() invisible(5) > > f() > > .Last.value > [1] 5 I understand .Last.value will capture the function returns, but that only happens in the top-level... I guess? In the followings co

Re: [Rd] tools:: extracting pkg dependencies from DCF

2022-10-28 Thread Gabriel Becker
Hi Jan, On Fri, Oct 28, 2022 at 1:57 PM Jan Gorecki wrote: > Gabriel, > > It is the most basic CI use case. One wants to install only > dependencies only of the package, and run R CMD check on the package. Really what you're looking for though, is to install all the dependencies which aren't

Re: [Rd] Lazy-evaluate elements wrapped with invisible

2022-10-28 Thread Bill Dunlap
You can play with the idea by returning an environment that contains delayed assignments. E.g., > f <- function(x) { +delayedAssign("eval_date", { cat("Evaluating 'date'\n"); date()}) +delayedAssign("sum_x", { cat("Evaluating 'sum_x'\n"); sum(x)}) +environment() + } > fx <- f(1:10) >

Re: [Rd] Lazy-evaluate elements wrapped with invisible

2022-10-28 Thread Gabriel Becker
Hi Dipterix, On Fri, Oct 28, 2022 at 1:10 PM Dipterix Wang wrote: > Hi, > > I was wondering if it is a good idea to delay the evaluation of expression > within invisible(), just like data()/delayedAssign()? > > The idea is a function might return an invisible object. This object might > not be

Re: [Rd] tools:: extracting pkg dependencies from DCF

2022-10-28 Thread Jan Gorecki
Gabriel, It is the most basic CI use case. One wants to install only dependencies only of the package, and run R CMD check on the package. Unless you say that installing the package and then running R CMD check on that package is considered good practice. Then yes, functionality I am asking about

[Rd] Lazy-evaluate elements wrapped with invisible

2022-10-28 Thread Dipterix Wang
Hi, I was wondering if it is a good idea to delay the evaluation of expression within invisible(), just like data()/delayedAssign()? The idea is a function might return an invisible object. This object might not be used by the users if the function returns are not assigned nor passed to anothe

[Rd] pmin() and pmax() should process a single list of vectors, rather than returning it

2022-10-28 Thread Sebastian Martin Krantz
Dear R Core, The {kit} package has a nice set of parallel statistical functions complimenting base R's pmin() and pmax(): psum(), pprod(), pmean(), etc.. These can be called on a set of vectors like pmin() and pmax() e.g. with(mtcars, psum(mpg, carb, wt)) or on a single list of vectors e.g. psum(

Re: [Rd] tools:: extracting pkg dependencies from DCF

2022-10-28 Thread Gabriel Becker
Hi Jan, The reason, I suspect without speaking for R-core, is that by design you should not be specifying package dependencies as additional packages to install. install.packages already does this for you, as it did in the construct of a repository code that I provided previously in the thread. Yo

Re: [Rd] tools:: extracting pkg dependencies from DCF

2022-10-28 Thread Jan Gorecki
Gabriel, I am trying to design generic solution that could be applied to arbitrary package. Therefore I went with the latter solution you proposed. If we wouldn't have to exclude base packages, then its a 3 liner file.copy("DESCRIPTION", file.path(tdir<-tempdir(), "PACKAGES")); db<-available.pack