From p.dalgaard@biostat.ku.dk  Mon Jun 18 21:38:38 2001
From: p.dalgaard@biostat.ku.dk (Peter Dalgaard BSA)
Date: 18 Jun 2001 22:38:38 +0200
Subject: [Rd] "[.data.frame" allows un-named 3rd subscript (PR#989)
In-Reply-To: cberry@tajo.ucsd.edu's message of "Mon, 18 Jun 2001 22:10:29 +0200 (MET DST)"
References: <200106182010.WAA14911@pubhealth.ku.dk>
Message-ID: <x27ky9o75d.fsf@blueberry.kubism.ku.dk>

cberry@tajo.ucsd.edu writes:

> Since the Extract page has usage as:
> 
>      x[i, j, ... , drop=TRUE]
> 
> I would expect that 'drop=' would need to be given to the third 'subscript'
> 
> > diag(4)[ , 4 , 4 ] # Forgot 'drop=' or added extra ','
> Error in diag(4)[, 4, 4] : incorrect number of dimensions
> > 
> > as.data.frame( diag(4) )[ , 4 , 4 ] # should return error, right?
> [1] 0 0 0 1
> 

And the bug is?

The generic indexing should really be x[...,drop=T].  Methods for
specific classes can specialize to a particular number of indices if
they want to, which is what is happening here

> get ("[.data.frame")
function (x, i, j, drop = if (missing(i)) TRUE else length(cols) == 
    1) 

one could fairly easily slip in a "..." argument after "j", and then
inside the function give an error if "..." is not empty, but what
would the point be?

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


[Rd] "[.data.frame" allows un-named 3rd subscript (PR#989)
Peter Dalgaard BSA