my take of the assignment was to avoid 'parse' specifically.
we start with a character vector, so avoiding characters is not possible. i was 
dealing with the fortune "if parse is the answer, you have the wrong question"

Sent from my iPhone

On Mar 29, 2025, at 15:39, Bert Gunter <bgunter.4...@gmail.com> wrote:


Thanks, Rich.

I thought of that, too, but it violates the spirit of my restraints (to avoid 
character strings), which I unfortunately did not clearly articulate. So my 
apologies for that failure. My concern is that with more complex model formula, 
using as.formula, etc. to parse/convert character strings can get a bit hairy. 
But in most cases, as here maybe, it may be perfectly fine. So think of my post 
as mostly my attempt to learn some new tricks rather than to solve a useful 
problem. I hope this is not unfair to the list.

Cheers,
Bert





On Sat, Mar 29, 2025 at 3:12 PM Richard M. Heiberger 
<r...@temple.edu<mailto:r...@temple.edu>> wrote:
> somenames <- c("Heigh", "Ho", "Silver", "Away")
> as.formula(paste("~(",paste(somenames, collapse="+"),")^2"))
~(Heigh + Ho + Silver + Away)^2
>

> On Mar 29, 2025, at 14:30, Bert Gunter 
> <bgunter.4...@gmail.com<mailto:bgunter.4...@gmail.com>> wrote:
>
> somenames <- c("Heigh", "Ho", "Silver", "Away")



        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide https://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to