Message-ID: <3E9ACDE5.1040800@statistik.uni-dortmund.de>
Date: 2003-04-14T15:04:05Z
From: Uwe Ligges
Subject: removing NULL elements from a list
In-Reply-To: <200304141609.58282.rdiaz@cnio.es>
Ramon Diaz wrote:
> Dear All,
>
> I have a list, where several components are NULL, and I'd like to obtain that
> very same list without the NULL components (i.e., I do not want to unlist or
> otherwise loose the rest of the list structure). I can do that with a loop,
> but how could I do it without a loop?
For a list L:
L[!sapply(L, is.null)]
Uwe Ligges