From p.dalgaard at biostat.ku.dk  Sat Sep 30 19:00:50 2006
From: p.dalgaard at biostat.ku.dk (Peter Dalgaard)
Date: 30 Sep 2006 19:00:50 +0200
Subject: [Rd] Strange behaviour of the [[ operator
In-Reply-To: <m2irj5e2d4.fsf@ziti.local>
References: <451DC321.2030704@fhcrc.org>
	<17694.33160.489389.196778@stat.math.ethz.ch>
	<m2irj5e2d4.fsf@ziti.local>
Message-ID: <x2odsxz3ul.fsf@turmalin.kubism.ku.dk>

Seth Falcon <sfalcon at fhcrc.org> writes:

> > Similar things happen in many similar circumstances.
> 
> Here's a similar thing:

Not really, no?
 
> > v <- 1:5
> > v
> [1] 1 2 3 4 5
> > v[mustBeDocumentedSomewhere=3]
> [1] 3
> 
> And this can be confusing if one thinks that subsetting is really a
> function and behaves like other R functions w.r.t. to treatment of
> named arguments:
> 
> > m <- matrix(1:4, nrow=2)
> > m
>      [,1] [,2]
> [1,]    1    3
> [2,]    2    4
> > m[j=2]
> [1] 2

Or even
> m[j=2,i=]
[1] 2 4

However, what would the argument names be in the >2-dim case? i, j are
used only in help("[") and that page is quite specific about
explaining that named matching doesn't work. 

-- 
   O__  ---- Peter Dalgaard             ?ster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)                  FAX: (+45) 35327907




[Rd] Strange behaviour of the [[ operator
Peter Dalgaard