[Rd] issue with [[<-Call
Prof Brian Ripley
ripley at stats.ox.ac.uk
Fri Dec 26 15:32:11 CET 2008
On Fri, 26 Dec 2008, Therneau, Terry M., Ph.D. wrote:
> Thanks for the comments.
> -- I agree that the vector form is more compact. I was using a loop
> because I found it to be even more transparent to the class. For a one
> time task such as this efficiency is not an issue.
> -- I'll make use of eval.parent(). I hadn't yet stumbled on that
> -- The code in lm() is almost exactly my "other approach"! (I doubt
> convergent evolution - I must have noticed this example at some past
> I was reasoning in parallel to lists
>> temp <- list(a=1:3)
>> temp[['b']] <- 5:6
>  1 2 3
>  5 6
> and assumed that this should work for call objects. The informal
> "underneath it all, all the language objects are lists" idea, which I
> think I absorbed from one of the original Bell Labs books. I leave it
> to the core team to decide if this should be 'fixed'.
Yes, that is true in S, but in R they are pairlists. The reason [<- works
is that it converts the pairlist to a list and back again. Names
(stricty, 'tags') on pairlists are something of a pain, but I have
already fixed up this case: some more complex ones remain unfixed.
> Terry T.
Brian D. Ripley, ripley at 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 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-devel