-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Convert to formula class #1
Comments
Thanks. It looks like a good suggestion that can be easily applied. |
In brief, this "issue" should be resolved by bd61027. To be more specific, the remotes::install_github("wenjie2wang/clusrank")
library(clusrank)
packageVersion("clusrank")
#> [1] '1.0.3'
## example data
df <- mtcars[, c("vs", "am", "mpg")]
names(df)
#> [1] "vs" "am" "mpg"
# [1] "vs" "am" "mpg"
varlist <- names(df)[1:2]
# [1] "vs" "am"
lapply(varlist, function(x) {
clusWilcox.test(substitute(mpg ~ i, list(i = as.name(x))), data = df)
})
#> [[1]]
#>
#> Clustered Wilcoxon rank sum test using Rosner-Glynn-Lee method
#>
#> data: mpg; group: vs; (from df)
#> number of observations: 32; number of clusters: 32
#> Z = 3.9342, p-value = 8.349e-05
#> alternative hypothesis: true difference in locations is not equal to 0
#>
#>
#> [[2]]
#>
#> Clustered Wilcoxon rank sum test using Rosner-Glynn-Lee method
#>
#> data: mpg; group: am; (from df)
#> number of observations: 32; number of clusters: 32
#> Z = 3.1291, p-value = 0.001753
#> alternative hypothesis: true difference in locations is not equal to 0 Created on 2022-07-28 by the reprex package (v2.0.1) |
Related SO post - https://stackoverflow.com/q/73136299/680068
Where
lm
works fine andclusWilcox.test
fails.lm
manual says:In
clusWilcox.test
check if it is not class of formula, then coerce to formula to avoid the error.The text was updated successfully, but these errors were encountered: