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 wrote:
>
> Note: I am almost certain that this has been asked and answered here
> before, so my apologies for the redun
Gabor, Duncan, et. al.
1. Thank you for your great comments and solutions. This is what I was
hoping for!
2. Duncan: I completely agree with your criticisms. In fact, I realized the
for() loop only needed the <- assignment, but your comment is important to
note. However, I didn't like the for() l
reformulate + update:
somenames |> reformulate() |> update(~ (.)^2)
On Sat, Mar 29, 2025 at 5:31 PM Bert Gunter 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 packages that
Option 1)
vec <- c("a", "b")
combinations <- sapply(2:length(vec), function(x) apply(combn(vec, x), 2,
paste, collapse = ":"))
vec <- c(vec, unlist(combinations))
vec
option 2) generate the interaction terms in the data frame with the data and
then read the column names to get the new vector of
On 2025-03-29 10:30 p.m., Bert Gunter wrote:
As always, I would like to thank all who responded for their insights and
suggestions. I have learned from them.
Thus far, my own aesthetic preference -- and therefore not to be considered
in any sense as a "best" approach -- is to use Duncan's sugges
Hello,
I thought of answering "reformulate can solve the problem" but how do
you create quadratic terms with reformulate?
~(Heigh + Ho + Silver + Away)^2
is still a problem with no solution that I know of but paste/as.formula.
Or Bert's bquote or substitute.
Rui Barradas
Às 23:18 de 29/03
6 matches
Mail list logo