-----Original Message-----
From: Deepayan Sarkar [mailto:deepayan.sarkar at gmail.com]
Sent: Friday, June 28, 2013 7:17 AM
To: Raubertas, Richard
Cc: R-devel at r-project.org
Subject: Re: [Rd] 'modifyList' drops (not adds) NULL components
On Thu, Jun 27, 2013 at 10:59 PM, Raubertas, Richard
<richard_raubertas at merck.com> wrote:
Dear list,
Utils::modifyList() drops NULL components in its second argument, instead
of adding them to the first argument. Compare:
modifyList(x=list(A=1), val=list(B=2, C=3))
$A
[1] 1
$B
[1] 2
$C
[1] 3
modifyList(x=list(A=1), val=list(B=NULL, C=3))
$A
[1] 1
$C
[1] 3
To me this seems inconsistent with the documentation ("Elements in 'val'
which are missing from 'x' are added to 'x'."),
Agreed.
and also with how I'd want the function to behave.
foo <- modifyList(x=list(A=1), val=list(B=NULL, C=3))
foo$B
NULL
So is there a specific reason you want the NULL elements to be
explicitly listed?
-Deepayan