The following examples are confusing to me. It is OK, to assigned NULL
to one element in a list. The result is still a list. However, a list
of NULL's are reduced to NULL. I don't understand how this conversion
occurs. Could somebody let me know what is going on?

> X=matrix(1:8, nr=4)
> apply(X,1, function(x) {if(x[[1]]==3){NULL}else{x[[1]]}})
[[1]]
[1] 1

[[2]]
[1] 2

[[3]]
NULL

[[4]]
[1] 4

> apply(X,1, function(x) {NULL})
NULL

______________________________________________
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