From rksh1 at cam.ac.uk  Tue Jan 25 16:34:38 2011
From: rksh1 at cam.ac.uk (Robin Hankin)
Date: Tue, 25 Jan 2011 15:34:38 +0000
Subject: [Rd] NA printing
Message-ID: <4D3EED8E.7050400@cam.ac.uk>

Hi.

I'm writing a print method for an object that includes a numeric matrix
for which
the lower diagonal elements are not meaningful.  So I make the lower
diagonal of my matrix NA and print it.

But my co-author does not like NA there and wants a dash.

I have tried coercing the matrix to character, essentially by
M[is.na(M)] <- "-" but this interferes with the pleasing
column alignment for numerical matrices.

How do I make R print "-" instead of "NA"  for NA entries in a numeric
matrix, without altering the vertical alignment?  Is there such a command
as

options(NA_string = "-")

available?

best wishes

Robin Hankin



[Rd] NA printing
Robin Hankin