You can replace missing values by ""
(this technique is used in print.dist
S3 method)
cf <- format(dat) ## use format to set other options like digits, justify , ...
cf[is.na(dat)] <- ""
cf
x a b c d
1 a 1 1 1 1
2 b 1 1 1
3 c 1 1
4 d 1