R-alpha: R 0.15: 2 small problems

Kurt Hornik (Kurt.Hornik@ci.tuwien.ac.at)
Mon, 30 Dec 1996 15:15:32 +0100


Date: Mon, 30 Dec 1996 15:15:32 +0100
Message-Id: <199612301415.PAA01406@aragorn.ci.tuwien.ac.at>
From: Kurt Hornik <Kurt.Hornik@ci.tuwien.ac.at>
To: r-testers@stat.math.ethz.ch
Subject: R-alpha: R 0.15:  2 small problems

Here are 2 more problems I recently noticed:

1.

	R> structure(1)
	Error: comparison is possible only for vector types


The problem is
	if (any(names(attrib) == "tsp"))
in the code for structure, which fails if no attribs were given.  An
easy fix would be to first test whether attrib is NULL.

(Also, `NULL == 0' should perhaps give NA rather than an error ...)

2.

	R> x <- structure(1:3, names=LETTERS[1:3])
	R> x
	A B C 
	1 2 3
	R> x + 1
	A B C 
	2 3 4
	R> 1 + x
	[1] 2 3 4

So addition is not entirely commutative :-)  (The same problem occurs for
subtraction, multiplication, and division.)

I haven't looked into this more closely.

Thanks,
-k
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
r-testers mailing list -- For info or help, send "info" or "help",
To [un]subscribe, send "[un]subscribe"
(in the "body", not the subject !)  To: r-testers-request@stat.math.ethz.ch
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-