[Rd] replicating lists

Prof Brian Ripley ripley@stats.ox.ac.uk
Wed, 11 Apr 2001 09:25:32 +0100 (BST)


On Wed, 11 Apr 2001, Jonathan Rougier wrote:

> Hi Everyone,
>
> At the moment it is not possible to replicate complex lists, but only
> simple ones:
>
> > rep(list(fred = 1:10), 10) # works fine
> > rep(list(fred = 1:10, happy = "squash"), 10)
> Error in rep(list(fred = 1:10, happy = "squash"), 10) :
>         Unimplemented feature in rep

It is implemented in S3 and S4.

> There is nothing in ?rep that suggests that the latter should not work,
> and I think it would be a desirable feature if it did.  For example, I
> want to create an array of lists, and it would be nice for me to set
> default values in the array function, rather than having to loop through
> the components and setting them individually.
>
> I've had a quick look in do_rep in seq.c and to my untrained eye it looks
> as though the LISTSXP case of the main switch might need to be replaced by
> a VECSXP, but I am not sure about other implications.

I suggest filing this as a bug report.

-- 
Brian D. Ripley,                  ripley@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 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

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