See the thread here

You'll need the Coin package.

```
library("coin")
lungtumor <- data.frame(dose = rep(c(0, 1, 2), c(40, 50, 48)),
tumor = c(rep(c(0, 1), c(38, 2)),
rep(c(0, 1), c(43, 7)),
rep(c(0, 1), c(33, 15))))
### linear-by-linear association test with scores 0, 1, 2
### is identical with Cochran-Armitage test
lungtumor$dose <- ordered(lungtumor$dose)
independence_test(tumor ~ dose, data = lungtumor, teststat = "quad",
scores = list(dose = c(0, 1, 2)))
Asymptotic General Independence Test
data: tumor by groups 0 < 1 < 2
T = 10.6381, df = 1, p-value = 0.001108
```

I've not tested this code, it's skimmed from the link.

Thanks. There is something which is not clear to me, however: what is the meaning of c(40, 50, 48) in dose = rep(c(0, 1, 2), c(40, 50, 48) ?

That's an example data frame to run the function.

`c(40, 50, 48)`

Are the number of repetitions of`c(0, 1, 2)`

, as it's wrapped in`rep`

.[here] link is broken.