I have a data.table
object as follows:
> ans
race smoking_status N
1: Asian Never 255
2: Asian Former 130
3: Asian Current 9
4: Black Never 421
5: Black Former 257
6: Black Current 215
7: Hispanic Current 184
8: Hispanic Never 910
9: Hispanic Former 525
10: White Never 2955
11: White Former 3109
12: White Current 1030
> class(ans)
[1] "data.table" "data.frame"
I want to get the number of smokers by race, and the proportions of never, former and current smokers, also by race. How do I do that?