From J.C.Rougier@durham.ac.uk  Wed Apr 11 09:34:28 2001
From: J.C.Rougier@durham.ac.uk (J.C.Rougier@durham.ac.uk)
Date: Wed, 11 Apr 2001 10:34:28 +0200 (MET DST)
Subject: [Rd] replicating lists (fwd) (PR#907)
Message-ID: <200104110834.KAA28896@pubhealth.ku.dk>

Filed as a bug, as suggested by Brian R., Jonathan.

Jonathan Rougier                       Science Laboratories
Department of Mathematical Sciences    South Road
University of Durham                   Durham DH1 3LE
tel: +44 (0)191 374 2361, fax: +44 (0)191 374 7388
http://www.maths.dur.ac.uk/stats/people/jcr/jcr.html

---------- Forwarded message ----------
Date: Wed, 11 Apr 2001 09:15:26 +0100 (BST)
From: Jonathan Rougier <dma0jcr@euclid.dur.ac.uk>
To: r-devel@stat.math.ethz.ch
Subject: replicating lists

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

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.

Cheers, Jonathan.

Jonathan Rougier                       Science Laboratories
Department of Mathematical Sciences    South Road
University of Durham                   Durham DH1 3LE
tel: +44 (0)191 374 2361, fax: +44 (0)191 374 7388
http://www.maths.dur.ac.uk/stats/people/jcr/jcr.html



-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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] replicating lists (fwd) (PR#907)
J.C.Rougier@durham.ac.uk