Hi,

I have a list:

tmp0 <- list(a=1, b=2, c=3)

And I realize that I can append a NULL element to the end of this list, just by 
writing:

length(tmp0) <- 4

Now, the question is, how can I assign NULL to one of the existing list 
elements without changing the length of the list?

Please note I am working from inside a for loop that is working on one list 
element at a time and in some circumstances I want to 
set one element to NULL. So, specifying the whole list again as in:

tmp0 <- list(a=1,b=NULL,c=3)

is not an option.

But writing, say:

tmp0 [[2]] <- NULL

is not an option either, because it leaves me with a list of length 2.

Is there a solution for this?

Thank you

______________________________________________
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