Let us assume the following scenario: assuming I want to cross tabulate Sex (M, F) by Tobacco (1 - Current, 2-Ex, 3-Never), but by excluding the Never smoking category. In stata a simple if Tobacco!=3 would suffice. However in R we need to subset the data prior to tabulating it:
```{r}
#subsetting the data
retinol1<-subset(retinol, tabac!=3)
table(retinol1$Sex, retinol1$tabac)
```
However, subsetting can be embedded directly if we are doing univariate analysis:
``` {r}
table(retinol$tabac[retinol$tabac!=3])
```
Update! Turns out that the function xtab has a subset option!
```
xtabs(~ Sex + tabac, retinol, subset = tabac != 3)
```