R-beta: losing attributes in binary ops

Robert Gentleman rgentlem at stat.auckland.ac.nz
Thu Jan 8 21:01:31 CET 1998


------------- Begin Forwarded Message -------------

>From maclean at stout.atd.ucar.edu Fri Jan  9 05:07 NZD 1998
From: maclean at stout.atd.ucar.edu (Gordon Maclean)
Date: Thu, 8 Jan 1998 16:09:15 GMT
Subject: losing attributes in binary ops
To: R at stat.auckland.ac.nz
Mime-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-MD5: ixXPlQ/KmxgOqsH2RHKzLg==


R developers,

Attributes are lost in binary operations.

R Version 0.61.0 Alpha (December 21, 1997)

Example:

	x <- 1:4
	attr(x,"foo") <- "bar"	
	attributes(x < 4)

returns NULL.

The "foo" attribute has been lost in the "x < 4" operation.
The blue book says that the result of binary operations should have
the attributes of the longer operand.

Thanks for R!

Gordon Maclean

Nat'l Center for Atmospheric Research
Boulder CO
------------- End Forwarded Message -------------

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list