Hi,
I would like to first, make a summary, contingency table for this data:
mydata <- structure(list(Sex = c("F", "M", "F", "F", "F", "F", "M", "M",
"F", "F", "F", "M", "M", "F", "M", "F", "M", "M", "F", "M", "F",
"F", "F", "F"), Q1 = c("A", "A", "A", "A", "A", "A", "A", "A",
"A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",
"A", "A", "A"), Q2 = c("B", "A", "A", "C", "B", "B", "B", "C",
"B", "C", "C", "C", "A", "B", "A", "B", "A", "A", "C", "C", "B",
"C", "B", "B")), class = c("tbl_df", "tbl", "data.frame"), row.names = c(NA,
-24L))
but I received an error:
invalid 'type' (character) of argument
and then I would like to do chisq.test() for this data but how to create a matrix from character data ? This is survey with questions and answers: A,B,C, etc. Sex variable consist of Female and Male values.
I have done it in SPSS but would like to do it in R as well and additionally I want to do "post hoc" comparisons between groups to get p-value. Any help will be greatly appreciated.
For "post hoc" tests I found this package:
https://cran.r-project.org/web/packages/chisq.posthoc.test/chisq.posthoc.test.pdf
As vignette says: "x is a matrix passed on to the chisq.test function".
So anyway I will have to create a matrix from this data.frame with character variables.