Data for Exercise 4.85
Kidsmoke
A data frame/tibble with 1000 observations on two variables
character vector with values female
and male
a character vector with values no
and yes
Kitchens, L. J. (2003) Basic Statistics and Data Analysis. Pacific Grove, CA: Brooks/Cole, a division of Thomson Learning.
T1 <- xtabs(~smoke + gender, data = Kidsmoke)
T1
#> gender
#> smoke female male
#> no 375 418
#> yes 105 102
prop.table(T1)
#> gender
#> smoke female male
#> no 0.375 0.418
#> yes 0.105 0.102
prop.table(T1, 1)
#> gender
#> smoke female male
#> no 0.4728878 0.5271122
#> yes 0.5072464 0.4927536
prop.table(T1, 2)
#> gender
#> smoke female male
#> no 0.7812500 0.8038462
#> yes 0.2187500 0.1961538