I wrote a function to parse the data.frame and it was throwing an error with rstatix::dunn_test which I cannot solve. This is because variable names are incorrect passed to the formula.
>selectedcolnames<-"SF36"
>group_name<-"therapy"
>dunn_test(eval(parse(text=glue("{selectedcolnames}")))~eval(parse(text=glue("{group_name}"))),data=data,p.adjust.method = "holm",detailed = F)
this give an error:
Error: Can't extract columns that don't exist.
x Column `eval(parse(text = glue("{group_name}")))` doesn't exist.
The column "SF36" with data and column "therapy" with grouping factor exist. I checked it works in:
wilcox.test(eval(parse(text=glue("{selected}")))~eval(parse(text=glue("{group_name}"))),data)
or
coin::wilcox_test(eval(parse(text=glue("{selected}")))~eval(parse(text=glue("{group_name}"))),data)
Have anyone any idea how to solve this?