Table including explicit NAs in R > 3.4.0
You can try setting the useNA argument to "always". In R 3.2.5,
table(vec_with_no_nas, useNA="always")
adds an NA column, even though no NAs are present.
vec_with_no_nas
A B C <NA>
1 2 1 0
The online help file for 3.4.0 (and 3.2.5) says
useNA controls if the table includes counts of NA values.
So this argument seems to do directly address what you want to do. The exclude argument allows the user to directly drop levels of a factor variable from the table output.
table(vec_with_no_nas, exclude="A")
vec_with_no_nas
B C
2 1
Which can be cleaner than dropping unwanted levels from a constructed table object.
note:
The online 3.4.0 help file mentions a pathological case in the simultaneous use of both exclude and useNA arguments and also provides an example that might be worth further exploration.