1

I would like to define my own categories in the R function table. For example, Instead of giving me the frequencies of the values that are bigger than 0, also give me the ones that are 0.

test <- c(1L, 1L, 4L, 2L, 1L, 1L, 4L, 7L, 1L, 1L, 2L, 1L, 2L, 
4L, 1L, 1L, 1L, 4L, 1L, 1L, 4L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 3L, 3L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 8L, 13L, 1L, 11L)

table(test)

1  2  3  4  7  8 11 13 

29  4  2  5  1  1  1  1

What I would like is also to have the values for 5, 6, 9, 10, 12. Indicating a frequency of 0.

Thanks

Bruno Vilela
  • 103
  • 8

0 Answers0