From p.dalgaard@biostat.ku.dk  Tue Dec 30 12:05:13 1997
From: p.dalgaard@biostat.ku.dk (Peter Dalgaard BSA)
Date: 30 Dec 1997 13:05:13 +0100
Subject: as.name is not idempotent
In-Reply-To: Douglas Bates's message of 29 Dec 1997 22:09:35 -0600
References: <6rwwgnxyio.fsf@franz.stat.wisc.edu>
Message-ID: <x2d8ifjati.fsf@blueberry.kubism.ku.dk>

Douglas Bates <bates@stat.wisc.edu> writes:

> At least I think the word I want "idempotent" - it has been a long
> debugging session and my brain is fried so I am not sure.

I.: f(f(x)) == f(x) all x, so it's exactly the right term...

> What I mean is that as.name applied to a name gives an error.
>  > as.name("foo")
>  foo
>  > as.name(as.name("foo"))
>  Error in as.name(x) : character argument required
> 
> It might help if it were a bit more flexible about the arguments it
> accepts.

This is plainly a bug. If it bothers you badly, insert 

if(is.name(x)) return(x)

at the start of as.name.

In general, it should invariably hold that

is.xx(x) == TRUE implies as.xx(x) == x
and
is.xx(as.xx(x)) == TRUE unless as.xx fails

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)             FAX: (+45) 35327907

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel 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-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


as.name is not idempotent
Peter Dalgaard BSA