[R] Change of parsing parameters to functions between 0.63.1 and 0.63.3 ?

Peter Dalgaard BSA p.dalgaard@biostat.ku.dk
25 Mar 1999 13:21:39 +0100


Prof Brian D Ripley <ripley@stats.ox.ac.uk> writes:

> On Wed, 24 Mar 1999, Athula Herath wrote:
> 
> > I wonder whether the mechanism of parsing parameters to functions has
> > changed between 0.63.1 and 0.63.3? The following code yeilds different
> 
> No, but the handling of attributes has.
> 
> > results in R 0.63.1 (Version 0.63.1  (Dec 5, 1998)) and R 0.63.3. 
> > 
> > cave<-function(x,a,b)
> > {
> > 	return(c(mean(x[a],na.rm=T),mean(x[b],na.rm=T)))
> > }
> > datx <- data.frame(rbind(c(1,2,3,4),c(4,5,6,7)))
> > names(datx)<-c("A","B","C","D")
> > f1<-c("A","C")
> > f2<-c("B","D")
> > t1<-apply(datx,1,cave,f1,f2)
> 
> The help page for apply says

(moved to R-devel)

Hmm. I actually committed my patch for apply() before seeing Brians
reply. Given that 

(a) The above code works as intended in Splus 3.4

(b) This is more or less orthogonal to the issue of having attributes
    to the result of a subsetting operation (it has to do with
    attributes on the arguments to FUN, not the result).

(c) Some effort was already being used in the case of more-than-one
    dimensional slices to get the names passed down [using
    array(newX[,i], d.call, dn.call) with dn.call containing the
    names]
    
..should I consider that a bad move?

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