I have a dataset with multiple categorical columns. I want to calculate the p-value using chisq.test for each and every pair of column. was trying this but it is giving an error.
e.g.
dataset
v1 v2 v3 v4
a q e f
a w g h
b z e i
c q e h
a = dataset
value = matrix(nrow=ncol(a), ncol=ncol(a))
for (i = 1:ncol(a)){
for (j = 1:ncol(a)){
tbl = table(a[,i],a[,j])
tst = chisq.test(tbl)
value[i,j] == tst$p.value
}
}
any leads will be rewarded