我有以下代码在 R 中生成数据集。但是,我想要图表中每个 x 值的实际精确值,并且无法弄清楚如何生成这些值。这是我的代码:
x <- c("CF", "CH", "CJ", "CE", "CN", "EC", "EN", "EJ", "AB", "BA", "KO", "OD", "DL", "HG")
px = c(0.08, 0.10, 0.06, 0.20, 0.04, 0.15, 0.02, 0.10, 0.025, 0.025, 0.05, 0.05, 0.05, 0.05)
draws = sample(x, size = 1000, replace = TRUE, prob = px)
barplot(height=table(draws))
如何获得每个 x 值(即 CF、CH、CE 等)的精确频率?