# Adding missing values while comparing two vector..

#### tsukiko

##### New Member
Let say i have

Code:
aa=c(0,2,3,5)
freq=c(13,4,5,2)
table_aa=cbind(aa,freq)
But, I want to have the final output something like:

Code:
table_aa
aa freq
0 13
[COLOR="red"]1  0[/COLOR]
2  4
3  5
[COLOR="red"]4  0[/COLOR]
5  2
So, i want to "automatically" generate for any value aa with zero frequency, i want to add the missing value of aa and its zero frequency into the table. So, i dont have to manually type and check this step again and again whenever i change the value of aa. Simply say, i want to add those missing line in table_aa generated by table(aa).

P/S: Actually table_aa is just a frequency table of aa which can be obtained using table(aa). But, as an example here, i simply set their values.

#### Mike White

##### TS Contributor
I am not sure how this question differs from your previous query on Count Frequency which received several solutions that appear to do what you want.