R “错误”;'的所有条目;x';必须是非负且有限的“;

R “错误”;'的所有条目;x';必须是非负且有限的“;,r,chi-squared,R,Chi Squared,我想知道两个类别之间的转化率是否存在统计上的显著差异 我的数据是这样的 operating_system converted 1 Mac FALSE 2 Mac FALSE 3 Windows FALSE 4 Windows TRUE 5 Windows FALSE 6 Mac TRUE 7 M

我想知道两个类别之间的转化率是否存在统计上的显著差异

我的数据是这样的

    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)
我收到了这个错误

chisq.test(df)中出错:“x”的所有条目必须为非负 有限的


chisq.test
使用列联表:

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))

df
chisq.test
使用列联表:

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))
df