SHARE
TWEET

Untitled

a guest Jul 21st, 2019 43 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. df = data.frame(x_1 = rnorm(200),
  2.               x_2 = rnorm(200),
  3.               group = c(rep('A',100),rep('B',100)),
  4.               clus = c(rep('a_1',50),rep('a_2',50),rep('b_1',50),rep('b_2',50)))
  5.      
  6. clusWilcox.test(x_1,paired = TRUE,cluster = "clus",data = df)
  7.      
  8. temp_test <-
  9.     df %>%
  10.     group_by(group) %>%
  11.  
  12.     summarise_each(funs(clusWilcox.test(.,paired = TRUE,cluster = "clus")$p.value), vars = c('x_1','x_2'))
  13.  
  14. Error in clusWilcox.test.default(x_1, paired = FALSE, cluster = "clus") :
  15.   'group' is required for the clustered rank sum test
  16.      
  17. temp_test <-
  18.         df %>%
  19.         group_by(group) %>%
  20.  
  21.         summarise_each(funs(clusWilcox.test(.,paired = TRUE,cluster = "clus",data = df)$p.value), vars = c('x_1','x_2'))
  22.  
  23. > temp_test
  24. # A tibble: 2 x 3
  25.   group vars1 vars2
  26.   <fct> <dbl> <dbl>
  27. 1 A     0.168 0.136
  28. 2 B     0.168 0.136
  29.      
  30. temp_test <-
  31.     df %>%
  32.     group_by(group) %>%
  33.  
  34.     summarise_each(funs(t.test(.)$p.value), vars = c('x_1','x_2'))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top