[R] NULL object, R programming

Makram Talih makram.talih at yale.edu
Fri Feb 28 04:07:02 CET 2003


Dear R users,

I get the following (I think puzzling) result when doing the following:

> a <- list(3,4,5)
> a[[2]] <- NULL
> a
[[1]]
[1] 3

[[2]]
[1] 5

I would have expected the result to be:

[[1]]
[1] 3

[[2]]
NULL

[[3]]
[1] 4

as in the outcome of:

> list(3, NULL, 4)

Is this a desired effect? If so, could it be built in a 'help(NULL)' file?

If you think it is relevant, I am using the following R version:

platform i386-pc-mingw32
arch     i386           
os       mingw32        
system   i386, mingw32  
status                  
major    1              
minor    6.2            
year     2003           
month    01             
day      10             
language R  


Many thanks for any clarifications regarding this!

Regards,

Makram Talih
Yale University
Statistics




More information about the R-help mailing list