# How to find correlation between numeric vector and logical vector? [duplicate]

I have

Water.use Income Number.of.Children.below.5 Diorrheal.incidence P0U.use
1        100  12000                          0                   0       1
2        120  13000                          1                   0       1
3        130  13000                          2                   0       1
4         96  12000                          0                   1       0
5         95  13000                          1                   1       0
6         95  11000                          0                   1       1
7         98  12000                          1                   1       0
8         97  11000                          0                   1       0
9         92  10000                          1                   1       0
10       103  12000                          0                   0       1
11       105  12500                          1                   0       1
12       101  12000                          0                   0       1
13       100  12000                          1                   0       0
14        97  11000                          2                   1       0
15        99  11000                          1                   1       0
16       100  12000                          0                   0       1
17       101  13000                          0                   0       1


where water use is numeric data and diorrheal incidence is logical , How can I find correlation in R?

• Logical is binary, not 0,1,2. Jun 23, 2016 at 7:17
• yeah there are only 0 and 1
– Rajit Ojha
Jun 24, 2016 at 9:40
• Since computing a correlation coefficient is unlikely to be of much use in any kind of analysis, could you explain what you are trying to learn about your data?
– whuber
Jun 29, 2016 at 12:35

We can use the ltm package
library(ltm)
biserial.cor(df1$Water.use, df1$Diorrheal.incidence)