[R] don't print object attributes on screen

Rolf Turner r.turner at auckland.ac.nz
Sun Jan 18 20:42:23 CET 2009


On 18/01/2009, at 7:55 PM, Pedro Mardones wrote:

> Dear all;
> I have a function written in R that returns as a list of values as
> output that has associated some user defined attributes to it. How can
> hide these attributes when printing the output on screen? I'm using
> R-2.8.1 on WinXP....it's like hiding the attr of the output from the
> scale function....
> Thanks in advance

I think that the only way that you can accomplish this ``in a general  
way''
is to assign a new class (e.g. ``foo'') to the object returned by your
function and then write a new print method, print.foo(). Something like

print.foo <- function(x,...) {
attributes(x) <- NULL
print(x)
}

HTH

	cheers,

		Rolf Turner

######################################################################
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}




More information about the R-help mailing list