Skip to content
Back to formatted view

Raw Message

Message-ID: <CAO-arWNPrJKipzZWcnVF5sea3LxMJK8ywXDxXNRdck3F0vh_5Q@mail.gmail.com>
Date: 2012-02-18T01:51:01Z
From: Benilton Carvalho
Subject: assigning NULL to a list element

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

Given that I could use

tmp0$a <- NULL

to remove 'a', I seem to understand why appending NULL returns me the
original list... But how should I proceed to actually have d=NULL
(just like I have 'b' in tmp0 above)?

Thank you very much,

benilton