Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in R Programming by (50.2k points)

Let's say for instance, I am having a formula like the following:

main_var ~ 0 + var1:x + var2:y + var3 + + var4 + (0 + main_var|x_y) + (0 + add_var|x_y) + (1|x_y)

I wanted to ask that how can to eliminate two consecutive pluses (+) between var3 and var4 (and leave only one)?

1 Answer

0 votes
by (107k points)

You can simply eliminate the consecutive pluses in r programming with the help of the following command:

as.formula( gsub( ""\\+s*\\+", "+", deparse(f)))

where f is your formula.

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...