On Sat, Feb 18, 2012 at 01:51:01AM +0000, Benilton Carvalho wrote:
> Hi everyone,
> 
> For reasons beyond the scope of this message, I'd like to append a
> NULL element to the end of a list.
> 
> tmp0 <- list(a=1, b=NULL, c=3)
> append(tmp0, c(d=4)) ## works as expected
> append(tmp0, c(d=NULL)) ## list with a/b/c only

Hi.

Besides the other solutions in this thread, the following
also works.

  append(tmp0, list(d=NULL))

  $a
  [1] 1
  
  $b
  NULL
  
  $c
  [1] 3
  
  $d
  NULL

Petr Savicky.

______________________________________________
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