Conditional proportions
The following code generates tables of joint and conditional proportions, respectively:
tab <- table(comics$align, comics$gender)
options(scipen = 999, digits = 3) # Print fewer digits
prop.table(tab) # Joint proportions
prop.table(tab, 2) # Conditional on columns
Go ahead and run it in the console. Approximately what proportion of all female characters are good?
Latihan ini adalah bagian dari kursus
Exploratory Data Analysis in R
Latihan interaktif praktis
Ubah teori menjadi tindakan dengan salah satu latihan interaktif kami.
Mulai berolahraga