2
$\begingroup$

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?

$\endgroup$
3
  • $\begingroup$ Logical is binary, not 0,1,2. $\endgroup$
    – zx8754
    Jun 23, 2016 at 7:17
  • $\begingroup$ yeah there are only 0 and 1 $\endgroup$
    – Rajit Ojha
    Jun 24, 2016 at 9:40
  • 1
    $\begingroup$ 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? $\endgroup$
    – whuber
    Jun 29, 2016 at 12:35

1 Answer 1

3
$\begingroup$

We can use the ltm package

library(ltm)
biserial.cor(df1$Water.use, df1$Diorrheal.incidence)
#[1] 0.5547232
$\endgroup$