removing NULL elements from a list: Thanks
Thank you very much for the very helpful responses from D. Bates, P. Dalgaard, J. Holtman, D. James, U. Ligges, V. Ogranovich, C. Ortega, B. D. Ripley and T. Plate. The original question is at the end. Most of the answers were: (A is the list, with the NULLs I want to get rid of) A[!sapply(A, is.null)] A[!unlist(lapply(A, is.null))] A[sapply(A, is.null)] <- NULL ## potentially confussing, as pointed out by B.D. Ripley Thanks again, Ram?n
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?
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 http://bioinfo.cnio.es/~rdiaz