X-Authentication-Warning: toucan.stats: ripley owned process doing -bs
Date: Wed, 11 Apr 2001 09:25:32 +0100 (BST)
From: Prof Brian Ripley <ripley@stats.ox.ac.uk>
X-X-Sender: <ripley@toucan.stats>
To: Jonathan Rougier <J.C.Rougier@durham.ac.uk>
cc: <r-devel@stat.math.ethz.ch>
Subject: Re: [Rd] replicating lists
MIME-Version: 1.0
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