0
votes

I have two columns of survey data. To get the chi-square values, I can use:

chisq.test(dat$colA, dat$colB)

for which the output might be

X-squared = 20, df = 5, p-value = 0.2909

How do I get the correlation between the two columns, with a value between -1 and 1?

Thanks.

1
fwiw, if your survey data comes from a complex sample, you need to use R's survey package :)Anthony Damico

1 Answers

2
votes

Use this: cor(dat$colA, dat$colB)