Re: [R] function problem: multi selection in one argument

2022-01-25 Thread Martin Maechler
> Rui Barradas > on Tue, 25 Jan 2022 14:22:47 + writes: > Hello, > Here are 3 functions that do what the question asks for. The first 2 are > tidyverse solutions, the last one a base R function. > I don't understand why the group_by and mutate, that's why I've in

Re: [R] function problem: multi selection in one argument

2022-01-25 Thread Rui Barradas
Hello, Here are 3 functions that do what the question asks for. The first 2 are tidyverse solutions, the last one a base R function. I don't understand why the group_by and mutate, that's why I've included a 2nd tidyverse function. And the base R function follows the same lines of outputing

Re: [R] function problem: multi selection in one argument

2022-01-25 Thread PIKAL Petr
nal Message- > From: R-help On Behalf Of Kai Yang via R-help > Sent: Tuesday, January 25, 2022 1:14 AM > To: R-help Mailing List > Subject: [R] function problem: multi selection in one argument > > Hello Team, > I can run the function below: > > library(tidyve

[R] function problem: multi selection in one argument

2022-01-24 Thread Kai Yang via R-help
Hello Team, I can run the function below: library(tidyverse) f2 <- function(indata, subgrp1){   indata0 <- indata   temp    <- indata0 %>% select({{subgrp1}}) %>% arrange({{subgrp1}}) %>%      group_by({{subgrp1}}) %>%     mutate(numbering =row_number(), max=max(numbering))   view(temp)   f_table