Reputation: 2597
I'd like to find out if there's a statistically significant difference in the conversion rate between two categories.
My data looks like this
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
I ran this code.
chisq.test(df)
And I received this error.
Error in chisq.test(df) : all entries of 'x' must be nonnegative and finite
Upvotes: 2
Views: 3339
Reputation: 5481
chisq.test
uses a contingency 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))
Upvotes: 2