Hello, I am summarizing a dataset using the base table() function. However, I want it to display empty categories , how do I achieve this? #RStats #DataScience
2
2
2
Replying to @thomaschula26
Make it a factor! #Rstats > vec <- c("red", "blue", "red") > table(vec) vec blue red 1 2 > fvec <- factor(vec, levels=c("red", "blue", "green")) > table(fvec) fvec red blue green 2 1 0 >

Aug 12, 2022 · 4:24 PM UTC

1
2
11
I've leant something today, thank you, that will be super useful.
4