Skip to content

Keeping factors with zero occurrences in "table" output

1 message · Liaw, Andy

#
If you make them into factors, the empty ones should show up:
f2
f1  1 2 3 5 6
  1 0 0 1 0 0
  2 0 0 1 0 0
  3 0 0 2 1 0
  4 0 1 0 0 1
  5 1 1 0 0 0
  7 0 0 0 1 0
ff2
ff1 1 2 3 4 5 6 7
  1 0 0 1 0 0 0 0
  2 0 0 1 0 0 0 0
  3 0 0 2 0 1 0 0
  4 0 1 0 0 0 1 0
  5 1 1 0 0 0 0 0
  6 0 0 0 0 0 0 0
  7 0 0 0 0 1 0 0

HTH,
Andy