R-beta: losing attributes in binary ops

Robert Gentleman (rgentlem@stat.auckland.ac.nz)
Fri, 9 Jan 1998 09:01:31 +1300 (NZDT)


Date: Fri, 9 Jan 1998 09:01:31 +1300 (NZDT)
From: Robert Gentleman <rgentlem@stat.auckland.ac.nz>
Message-Id: <199801082001.JAA28724@stat1.stat.auckland.ac.nz>
Subject: R-beta: losing attributes in binary ops
To: r-help@stat.math.ethz.ch

Content-MD5: 3MqXMhFQvBt7TygGtT894w==
Sender: owner-r-help@stat.math.ethz.ch
Precedence: bulk

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

>From maclean@stout.atd.ucar.edu Fri Jan  9 05:07 NZD 1998
From: maclean@stout.atd.ucar.edu (Gordon Maclean)
Date: Thu, 8 Jan 1998 16:09:15 GMT
Subject: losing attributes in binary ops
To: R@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@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._