This is a *plain text* list. I find your HTML (below) unreadable. I suggest you re-post to make it easier for others to help.
Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Mon, May 24, 2021 at 4:53 PM Kai Yang via R-help <r-help@r-project.org> wrote: > Hello list,I want to translate some of the R code into function, but I got > error message. I'm new for R. please point out where is my problem.thank > you,Kai > the original working code:p1 <- select(raw ,Pedigree.name > ,UPN ,Test.Result.tr_Test.Result1 > ,Test.Result.tr_gene1 ,Test.Result.tr_Variant..nucleotide.1 > )p2 <- select(raw ,Pedigree.name ,UPN > ,Test.Result.tr_Test.Result2 ,Test.Result.tr_gene2 > ,Test.Result.tr_Variant..nucleotide.2)p3 <- select(raw > ,Pedigree.name ,UPN ,Test.Result.tr_Test.Result3 > ,Test.Result.tr_gene3 > ,Test.Result.tr_Variant..nucleotide.3)p4 <- select(raw > ,Pedigree.name ,UPN ,Test.Result.tr_Test.Result4 > ,Test.Result.tr_gene4 > ,Test.Result.tr_Variant..nucleotide.4)p5 <- select(raw > ,Pedigree.name ,UPN ,Test.Result.tr_Test.Result5 > ,Test.Result.tr_gene5 > ,Test.Result.tr_Variant..nucleotide.5) > > I tried to write a function to do this:k_subset <- function(pp, aa, bb, > cc){ pp <- substitute(pp) aa <- substitute(aa) bb <- substitute(bb) > cc <- substitute(cc) pp <- select(raw ,Pedigree.name > ,UPN ,aa ,bb ,cc > ) }k_subset(p1, Test.Result.tr_Test.Result1, Result.tr_gene1, > Test.Result.tr_Variant..nucleotide.1 )but I got error message: Note: Using > an external vector in selections is ambiguous.i Use `all_of(aa)` instead of > `aa` to silence this message.i See < > https://tidyselect.r-lib.org/reference/faq-external-vector.html>.This > message is displayed once per session.Note: Using an external vector in > selections is ambiguous.i Use `all_of(bb)` instead of `bb` to silence this > message.i See < > https://tidyselect.r-lib.org/reference/faq-external-vector.html>.This > message is displayed once per session. Error: Can't subset columns that > don't existx Column `Result.tr_gene1` doesn't exist. > > > > > [[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 > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > [[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 http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.