我想计算我的变量的效应大小。我得到了错误“丢失值wher TRUE/FALSE needed”,即使我清除了我的数据。NAs帧之前。你知道为什么会发生这种情况吗?
我正在使用rstatix . R版本4.2.2(2022-10-31 ucrt)平台的cohens_d()
函数:x86_64-w 64-mingw 32/x64(64位)运行环境:Windows 10 x64(内部版本号19044)
我的data.frame看起来像这样:
structure(list(y = c(7.18497519069826, 7.3003780648707, 7.17955179116519,
8.36921585741014, 8.15836249209525, 7.09061070782841, 7.49108141342319,
7.1846914308176, 6.67089495352021, 6.69143515214406, 6.42357351973274,
7.52608069180203, 7.24501887073775, 6.85901814388889, 7.57170883180869,
7.33425264233423, 8.04921802267018, 7.03181227133037, 7.59494473669508,
7.19479175772192, 7.50365451924296, 7.98766626492627, 7.69670578093392,
7.60357736815147, 6.96018527660461, 6.87390159786446, 7.06818586174616,
7.73303668293358, 7.00902574208691, 7.43980621139333, 7.21563756343506,
7.28869626059026, 7.16435285578444, 8.40397796366936, 8.11092624226642,
6.87139778148748, 7.28510702956681, 7.28533222764388, 7.09131515969722,
6.75541746281094, 7.48515334990365, 7.04727486738418, 7.05153839051533,
6.94610823043691, 6.88677264305444, 7.17522180034305, 8.01535975540921,
6.97657921864011, 7.44994098877334, 7.24328614608345, 6.94987770403687,
7.0265332645233, 7.03662889536216, 6.7070589406276, 7.44075170047919,
6.58972625625424, 6.75913881628117, 7.41597441137657, 7.57460994134019
), x = structure(c(1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 3L, 1L, 1L, 1L, 1L, 1L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L
), levels = c("untreated", "VRZ", "AMB", "untreated_107"), class = "factor")), row.names = c(NA,
-59L), class = c("tbl_df", "tbl", "data.frame"), na.action = structure(c(`58` = 58L), class = "omit"))
r_test %>%
cohens_d (y~ x) %>%
as.data.frame()
你知道问题出在哪里吗?
类似地,当我尝试使用函数wilcox_effsize()
时,R返回以下错误:“无法处理只包含一个级别的因子”
1条答案
按热度按时间brccelvz1#
如果您将
x
转换为字符,它将工作: