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

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)  

[R] function problem

2009-07-31 Thread RRRRRRRRRR!
I have a series of columns that need to be evaluated in various tables. I need to apply a function in the following manner somers2(name1,name2). name1 is a vector of x inputs for the function which correspond to a vector of y inputs in name2. y-rep(c(3,4,5,8),6) z-rep(c(23,24,25,26,27,28),4)

Re: [R] function problem

2009-07-31 Thread Steve Lianoglou
Hi, On Jul 31, 2009, at 12:25 PM, RR! wrote: I have a series of columns that need to be evaluated in various tables. I need to apply a function in the following manner somers2(name1,name2). name1 is a vector of x inputs for the function which correspond to a vector of y inputs in

Re: [R] function problem

2009-07-31 Thread RRRRRRRRRR!
I am sorry I should have stated the whole problem: I appreciate all the help I have received from this list and also not being flamed because I am new to R. Many of my problems are in automation so far. I am trying to create multiple objects that are outputs of functions. Here are the tasks: