You can calculate the relative risk as (pos1/total1)/(pos2/total2)
here, pos1 is the samples in the first group,
pos2 in the second group.
Use the epitab function of the epitools package:
## install.packages("epitools")
library("epitools")
After installing, try this:
tab <- matrix(c(4,16,40,168),byrow=TRUE,nrow=2)
epitab(tab,method="riskratio")
## $tab
## Outcome
## Predictor Disease1 p0 Disease2 p1 riskratio lower upper
## Exposed1 4 0.2000000 16 0.8000000 1.000000 NA NA
## Exposed2 40 0.1923077 168 0.8076923 1.009615 0.8030206 1.269361
## Outcome
## Predictor p.value
## Exposed1 NA
## Exposed2 1
I hope this helped.