Possible Duplicate:
Sorting and grouping data using R
I am a student that is learning R. I have already looked at some of the introduction stuff, that has been posted online. But I cant find a solution to my problem, which I'm sure is quite easy.
So say I have a vector
a <- c(1,2,6,5,3)
and I make a table of a
,
> table(a)
a
1 2 3 5 6
1 1 1 1 1
I just wondering how to put zeroes in where the number is not there. I want to get something like:
> table(a)
a
1 2 3 4 5 6
1 1 1 0 1 1