[R] removing NULL elements from a list

Carlos Ortega carlos.ortega at minorplanet.com
Mon Apr 14 17:14:48 CEST 2003


Have you tried:

lapply(your_list, na.omit)


-----Mensaje original-----
De: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch]En nombre de Ramon Diaz
Enviado el: lunes, 14 de abril de 2003 16:10
Para: R-Help (E-mail)
Asunto: [R] removing NULL elements from a list

Dear All,

I have a list, where several components are NULL, and I'd like to obtain
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?



Ramón Díaz-Uriarte
Bioinformatics Unit
Centro Nacional de Investigaciones Oncológicas (CNIO)
(Spanish National Cancer Center)
Melchor Fernández Almagro, 3
28029 Madrid (Spain)
Fax: +-34-91-224-6972
Phone: +-34-91-224-6900


R-help at stat.math.ethz.ch mailing list

###  This email has been checked for all known viruses by the
###  Firstnet anti-virus system - http://www.firstnet.net.uk
###  Please email fav at firstnet.net.uk for details.

The information in this email is confidential and it may not be\... {{dropped}}

More information about the R-help mailing list