[R] subset using noncontiguous variables by name (not index)

Muenchen, Robert A (Bob) muenchen at utk.edu
Mon Aug 27 20:28:16 CEST 2007


Thanks for helping me see why R doesn't have the "obvious"! -Bob

> -----Original Message-----
> From: Thomas Lumley [mailto:tlumley at u.washington.edu]
> Sent: Monday, August 27, 2007 2:12 PM
> To: Muenchen, Robert A (Bob)
> Subject: RE: [R] subset using noncontiguous variables by name (not
> index)
> 
> On Mon, 27 Aug 2007, Muenchen, Robert A (Bob) wrote:
> 
> > Thomas, that's a good point. I was thinking of anscombe[x1::y1]
> making
> > it clear which one, but you would then want just x1::y1 to have
> > unambiguous meaning on its own, which is impossible.
> >
> > As for x1:xN, it's unambiguous on its own.
> 
> 
> It actually isn't. We already have a meaning. Consider
>    x1<-4
>    xN<-6
>    x1:xN
> It also breaks R's argument passing rules by treating x1 as string
> rather than a name.
> 
> What would be unambiguous at the moment is "x1":"x4", provided there
> was a sufficiently precise set of rules on what was allowed. Consider
>   "x1":"x-1"    (negative?)
>   "x1":"x3.14"  (non-integer?)
>   "x3.12":"x3.14" (is the prefix x or x3.?)
>   "x1":"X4"     (the prefix changes)
>   "01":"14"     (is the prefix empty or 0?)
>   "x09":"xA2"     (is this illegal decimal or legal hexadecimal?)
>   "IL23R1":"IL23R4" (what is the prefix?)
>   "x1a":"x4a"    (infix numbering?)
> 
> 
> 
>       -thomas
> 
> Thomas Lumley			Assoc. Professor, Biostatistics
> tlumley at u.washington.edu	University of Washington, Seattle
>



More information about the R-help mailing list