小编cur*_*rat的帖子

并行wilcox.test使用group_by和summary

必须有一种R-ly方式wilcox.test使用group_by并行调用多个观察.我已经花了很多时间阅读这篇文章,但仍然无法弄清楚是否wilcox.test有这样的工作.下面的示例数据和代码,使用magrittr管道和summarize().

library(dplyr)
library(magrittr)

# create a data frame where x is the dependent variable, id1 is a category variable (here with five levels), and id2 is a binary category variable used for the two-sample wilcoxon test
df <- data.frame(x=abs(rnorm(50)),id1=rep(1:5,10), id2=rep(1:2,25))

# make sure piping and grouping are called correctly, with "sum" function as a well-behaving example function 
df %>% group_by(id1) %>% summarise(s=sum(x))
df %>% group_by(id1,id2) %>% summarise(s=sum(x))

# make sure wilcox.test is …
Run Code Online (Sandbox Code Playgroud)

r group-summaries dplyr magrittr

6
推荐指数
2
解决办法
2504
查看次数

标签 统计

dplyr ×1

group-summaries ×1

magrittr ×1

r ×1