R-alpha: S <-> R: names(..)

Martin Maechler (maechler@stat.math.ethz.ch)
Fri, 28 Jun 96 15:15:11 +0200


Date: Fri, 28 Jun 96 15:15:11 +0200
Message-Id: <9606281315.AA05156@>
From: Martin Maechler <maechler@stat.math.ethz.ch>
To: R-testers@stat.math.ethz.ch
Subject: R-alpha: S <-> R: names(..)


Is it on purpose that R differs from S here?
Is there a situation where R's behavior should be preferable?

R 0.9:
> names(list(1:3, pi=pi))
[1] "NA" "pi"


S:
> names(list(1:3, pi=pi))
[1] ""   "pi"


------------------------------------------------------------------------

[there are  other situations where R doesn't treat    'named vectors' 
 properly; e.g.

	c(a = 1, b= 3)  # loses names

	unlist(list(a = 1, b = 5)) # loses names

]

S even does this, which is quite nice and useful sometimes :
> unlist(list( v = 1:3, pi=pi))
 v1 v2 v3       pi 
  1  2  3 3.141593

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
r-testers mailing list -- To (un)subscribe, send
subscribe	or	unsubscribe
(in the "body", not the subject !)  To: r-testers-request@stat.math.ethz.ch
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-