Displaying 2 results from an estimated 2 matches for "recursecall".
2025 Mar 30
1
Creating model formulas programmatically
...ither; I *much* preferred your
Reduce() solution which is exactly the sort of elegant functionally based
solution that R excels at. I am glad that you put it into the record.
3. If I may indulge those who are following this thread, yet another simple
approach that just uses call() recursively is:
recurseCall <- function(nms, FUN = '+')
{
if(length(nms) > 2) call(FUN, nms[[1]], Recall(nms[-1]))
else call(FUN, nms[[1]],nms[[2]])
}
## yielding
> recurseCall(nms)
Heigh + (Ho + (Silver + Away))
While this result is different than that given by the others, it is
syntactically equivale...
2025 Mar 30
1
Creating model formulas programmatically
Another solution. reformulate + substitute + as.formula:
substitute(~ (.)^2, list(. = reformulate(somenames)[[2]])) |> as.formula()
On Sat, Mar 29, 2025 at 5:31?PM Bert Gunter <bgunter.4567 at gmail.com> wrote:
>
> Note: I am almost certain that this has been asked and answered here
> before, so my apologies for the redundant query.
>
> I also know that there are several