[Rd] 'modifyList' drops (not adds) NULL components

Raubertas, Richard richard_raubertas at merck.com
Thu Jun 27 19:29:46 CEST 2013


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'."), and also with how I'd want the function to behave.

> sessionInfo()
R version 3.0.1 Patched (2013-06-16 r62969)
Platform: x86_64-w64-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=English_United States.1252 
[2] LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     


Richard Raubertas
Merck & Co.


Notice:  This e-mail message, together with any attachme...{{dropped:11}}



More information about the R-devel mailing list