I'm new to R and I'm trying to find the correlation between a numeric variable and a factor one. I have a data frame with the following 3 columns: 1. nr of clicks (range 0:14) 2. response (1= "YES", 0="NO") 3. Frequencies - no of counts (how many clients responded "YES" with X no of clicks)

So, the no of rows of the table is 28.

How can I measure the correlation between the dependent variable, response, and the numeric one?

Thanks! Rodica


1 Answer 1


In order to determine correlation between heterogeneous variables, you can use hetcor() function from the polycor R package: http://cran.r-project.org/web/packages/polycor.

  • 1
    $\begingroup$ Please keep in mind that the package seems to rely on factor orderings. The package does not seem to give sensible results for unordered variables. $\endgroup$ Jun 3, 2019 at 11:44
  • $\begingroup$ @HolgerBrandl It was a while ago, but thank you for letting me know. :-) $\endgroup$ Jun 3, 2019 at 20:00
  • 2
    $\begingroup$ See stackoverflow.com/a/56485520/590437 for an alternative implementation $\endgroup$ Jun 7, 2019 at 9:10
  • $\begingroup$ @HolgerBrandl Interesting. Thank you for sharing. $\endgroup$ Jun 7, 2019 at 16:16

Not the answer you're looking for? Browse other questions tagged or ask your own question.