From Martin Maechler <maechler@stat.math.ethz.ch>  Fri Jul 23 08:44:12 1999
From: Martin Maechler <maechler@stat.math.ethz.ch> (Martin Maechler)
Date: Fri, 23 Jul 1999 09:44:12 +0200
Subject: lapply( *, names) -- bug ?!
In-Reply-To: <Pine.GSO.4.05.9907230823340.29439-100000@auk.stats> (message
 from Prof Brian D Ripley on Fri, 23 Jul 1999 08:28:35 +0100 (BST))
References: <Pine.GSO.4.05.9907230823340.29439-100000@auk.stats>
Message-ID: <199907230744.JAA05728@sophie.ethz.ch>

>>>>> On Fri, 23 Jul 1999 08:28:35 +0100 (BST), Prof Brian D Ripley <ripley@stats.ox.ac.uk> said:

    BDR> On Fri, 23 Jul 1999, Martin Maechler wrote:
    >> This came on S-news
    >> 
    >> The more direct test being
    >> 
    >> sapply(c(a=1,b=2), names)
    >> 
    >> Problem:  
    >> R ("all" versions) 
    >> behaves the same as S+5.1, which is wrong IMO.
    >> 
    >> {since some might disagree,  I didn't yet post to R-bugs ..}

    BDR> I do.  the argument is not a list, and lapply applies to lists.
that was not the point;
lapply() and sapply() are supposed to coerce to list()
    BDR> So
    >> as.list(c(a=1,b=2))
    BDR> $a
    BDR> [1] 1

    BDR> $b
    BDR> [1] 2

    BDR> Fine. Note the names of the components are NULL.

Yes, exactly.  

And therefore lapply(*, names) {or sapply(..)} should return NULLs
as it does [in R and S+5.x].
I was wrong all along.
It seems I need a longer warm-up time for my brain today...

Martin
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


lapply( *, names) -- bug ?!
Martin Maechler