From ripley@stats.ox.ac.uk  Fri Jul 23 08:28:35 1999
From: ripley@stats.ox.ac.uk (Prof Brian D Ripley)
Date: Fri, 23 Jul 1999 08:28:35 +0100 (BST)
Subject: lapply( *, names) -- bug ?!
In-Reply-To: <199907230715.JAA04888@sophie.ethz.ch>
Message-ID: <Pine.GSO.4.05.9907230823340.29439-100000@auk.stats>

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 ..}

I do.  the argument is not a list, and lapply applies to lists. So
> as.list(c(a=1,b=2))
$a
[1] 1

$b
[1] 2

Fine. Note the names of the components are NULL.


> 
> ------- Start of forwarded message -------
> Date: Thu, 22 Jul 1999 23:14:57 -0230
> From: "Paul Y. Peng" <ypeng@math.mun.ca>
> To: s-news <s-news@wubios.wustl.edu>
> Subject: [S] Feature or bug?
> 
> In S-PLUS 3.3 (DEC Alpha) and S-PLUS 2000,
> 
> > z <- c("a"=1, "b"=2)
> > lapply(z, function(x)names(x))
> $a:
> [1] "a"
> 
> $b:
> [1] "b"
> 
> But in S-PLUS 5.1 (Linux),
> 
> > z <- c("a"=1, "b"=2)
> > lapply(z, function(x)names(x))
> $a:
> NULL
> 
> $b:
> NULL
> 
> Is this a new feature of S-PLUS 5? Do I miss anything in
> S-PLUS 5? Thank you for your help.
> ------- End of forwarded message -------
> 
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> 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
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
> 

-- 
Brian D. Ripley,                  ripley@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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 ?!
Prof Brian D Ripley