Re: [R] obtaining null components of a list

2009-01-21 Thread jim holtman
Try this: > x <- list(NULL, 1:10, 25, NULL, "more") > x [[1]] NULL [[2]] [1] 1 2 3 4 5 6 7 8 9 10 [[3]] [1] 25 [[4]] NULL [[5]] [1] "more" > which(sapply(x, is.null)) [1] 1 4 > On Wed, Jan 21, 2009 at 7:42 AM, diego Diego wrote: > Hello everybody! > I have a list of length 5000

[R] obtaining null components of a list

2009-01-21 Thread diego Diego
Hello everybody! I have a list of length 5000 whose components are (mostly) "ts" objects, but some these components are intentionally left empty, ie, they are "NULL" components of the list. My question is how can I get the position of these null components in a effective way (I'm trying to avoid a