group_by'在r中执行shapiro_test时功能
我之前曾问过这个问题,没有运气,所以再次出现:
我的数据框架:
data.type <- c("DNA","DNA","DNA","DNA","DNA","DNA","DNA","DNA","DNA","DNA","DNA","DNA","DNA","DNA","DNA","DNA","DNA","DNA","DNA","DNA","DNA","RNA","RNA","RNA","RNA","RNA","RNA","RNA","RNA","RNA","RNA","RNA","RNA","RNA","RNA","RNA","RNA","RNA","RNA","RNA","RNA","RNA")
hour <- c(1,1,1,2,2,2,24,24,24,48,48,48,96,96,96,168,168,168,672,672,672,1,1,1,2,2,2,24,24,24,48,48,48,96,96,96,168,168,168,672,672,672)
zotu.count <- c(11,14,16,7,16,15,5,14,13,6,5,17,7,7,12,3,4,5,3,5,4,2,3,2,1,6,2,1,1,1,1,0,0,1,1,4,1,1,1,6,7,6)
id <- c(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42)
我正在尝试使用以下代码进行shapiro测试以测试我的数据正态性,并给出以下错误:
dataset %>% group_by(data.type, hour) %>% shapiro_test(zotu.count)
Error: Problem with `mutate()` column `data`.
ℹ `data = map(.data$data, .f, ...)`.
x Problem with `mutate()` column `data`.
ℹ `data = map(.data$data, .f, ...)`.
x all 'x' values are identical
这是非常奇怪的正如它以前在另一个具有相同数据结构的数据集上使用的那样,但我不知道为什么现在会遇到此错误。我很沮丧,因为我已经搜寻了互联网以寻求答案,但什么都没有。任何能够提供帮助的人都是天赐之物!
谢谢你!
I've asked this question previously with no luck, so here goes again:
My dataframe:
data.type <- c("DNA","DNA","DNA","DNA","DNA","DNA","DNA","DNA","DNA","DNA","DNA","DNA","DNA","DNA","DNA","DNA","DNA","DNA","DNA","DNA","DNA","RNA","RNA","RNA","RNA","RNA","RNA","RNA","RNA","RNA","RNA","RNA","RNA","RNA","RNA","RNA","RNA","RNA","RNA","RNA","RNA","RNA")
hour <- c(1,1,1,2,2,2,24,24,24,48,48,48,96,96,96,168,168,168,672,672,672,1,1,1,2,2,2,24,24,24,48,48,48,96,96,96,168,168,168,672,672,672)
zotu.count <- c(11,14,16,7,16,15,5,14,13,6,5,17,7,7,12,3,4,5,3,5,4,2,3,2,1,6,2,1,1,1,1,0,0,1,1,4,1,1,1,6,7,6)
id <- c(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42)
I am trying to do a shapiro test to test for normality of my data using the following code and am being given the following error:
dataset %>% group_by(data.type, hour) %>% shapiro_test(zotu.count)
Error: Problem with `mutate()` column `data`.
ℹ `data = map(.data$data, .f, ...)`.
x Problem with `mutate()` column `data`.
ℹ `data = map(.data$data, .f, ...)`.
x all 'x' values are identical
This is very strange as it has worked before on another dataset with the same data structure but I have no idea why I'm getting this error now. I am very frustrated as I have scoured the internet for answers and have nothing. Anybody who might be able to help would be a godsend!
Thank you!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果/else 条件为此,我们可以使用
- 检查'zotu.count'中有多个唯一值的位置,并应用
shapiro_test
-Output,
我们也可以<代码>过滤器将仅具有一个唯一值的组
We could use an
if/else
condition for this - checking where there are more than one unique values in 'zotu.count' and apply theshapiro_test
-output
We may also
filter
out those groups that have only a single unique value