I have created a sample with replacement as follows and I would to have the frequency of each element of the vector, however by table function in R, I only get the frequency of the elements that appear on the sample. How can I get the zero frequencies for the rest of elements that not appear in the sample.
> t = 1:15
> x = sample(t, 10, replace=TRUE)
> table(x)
x
2 3 4 5 6 7 8 10
1 1 1 2 1 1 2 1
As the output I would like to have a data.frame where the first column is 1:15 and the second column is the frequencies of each element.