Hi Joshua,

thanks, I came up with that solution myself after a bit of thinking.
Normally I wouldn't worry about NULL components of lists, but dimnames
is a list and often some components are null and is therefore a bit
tricky to manipulate...

Peter

On Mon, Sep 20, 2010 at 7:39 PM, Joshua Wiley <jwiley.ps...@gmail.com> wrote:
> Sorry, that was a really half-hearted reply.  This will create a new
> list that is the old list shifted down (and should be much faster than
> the for loop too).
>
> lst <- list(NULL,2)
> lst2 <- vector("list", length(lst) + 1)
> lst2[2:length(lst2)] <- lst
> lst
> lst2
>
> If you really need to use a for loop, maybe try filling it with NAs
> instead of NULLs?
>
> Josh

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to