[R] help to correct the function problem
Kai Yang
y@ngk@|9999 @end|ng |rom y@hoo@com
Tue May 25 01:53:22 CEST 2021
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]]
More information about the R-help
mailing list