Compare official population distribution with sample? I have official numbers regarding the population of specific ZIP codes that belong to a certain region, e.g. 90210 has population of 20.000 (just an example). (The set of ZIPs comprises a city and its surrounding region).
Now I have issued a survey asking over 5000 people living in these ZIP codes.
Now, I would like to prove that the proportions of the people living in specific ZIP codes correlates for my sample (sample_no) and the official numbers (total_no).
ZIP    total_no    sample_no    
1         23209           12
2         18762            7
3         56229           21

Which statistical test should be applied?
I tried this. Is this a valid approach? What would you suggest? I'd like to do this using the R framework.
 A: Using the data above, the approach from the OP gives a p-value of 0.6384
total_no = c(23209, 18762, 56229)
sample_no = c(12, 7, 21)
prop.test(matrix(c(total_no, sample_no), nrow=3, ncol=2))

A straight forward chi-squared test also gives the sample p-value
chisq.test(matrix(c(total_no, sample_no), nrow=3, ncol=2))

However, I don't believe this is the best answer. In this situation, because we are checking if our random sample matches that of the original population, our target probability is exactly that of the original population. We shouldn't be using the marginal probabilities to create our expected values but the original population instead. 
chisq.test(sample_no, p=total_no/sum(total_no))

or
expected_no = (total_no / sum(total_no)) * sum(sample_no)
chisq <- sum((sample_no - expected_no) ^2 / expected_no)
1-pchisq(chisq, df=(length(total_no)-1))

This method gives a p-value of 0.6383. Because the sample size is so small, it has a small effect on the marginal probabilities and the two approaches give the similar results.
It is important to mention that the statistic best approaches a chi-squared distribution when the sample sizes are large. There is one rule of thumb is that every sample needs at least 5 observations. There are many variations of this rule of thumb. If you are uncomfortable that your data doesn't meet this requirement, it is common to combine groups until the sample sizes are large enough.
A: Use Chi-squared test:
tbl <- table(data$total_no, data$sample_no)
chisq.test(tbl)

EDIT:
As was pointed out, the "rule of thumb" of 5 samples per ZIP should be met.
