错误 "all entries of 'x' must be nonnegative and finite"

Error "all entries of 'x' must be nonnegative and finite"

我想了解两个类别之间的转化率在统计上是否存在显着差异。

我的数据是这样的

    operating_system converted
1             Mac     FALSE
2             Mac     FALSE
3         Windows     FALSE
4         Windows      TRUE
5         Windows     FALSE
6             Mac      TRUE
7             Mac     FALSE
8         Windows     FALSE
9             Mac     FALSE
10            Mac     FALSE

我运行这个代码。

chisq.test(df)

我收到了这个错误。

Error in chisq.test(df) : all entries of 'x' must be nonnegative and finite

chisq.test 使用应急 table :

df <- data.frame(operating_system = c("Mac", "Mac", "Windows", "Windows", "Windows", "Mac", "Mac", "Windows", "Mac", "Mac"),
             converted = c(F, F, F, T, F, T, F, F, F, F), stringsAsFactors = TRUE)

chisq.test(table(df))