s-news
[Top] [All Lists]

Re: How to drop null elements of a list?

To: Patrick Joseph <patrick_nospam@hotmail.com>, s-news@wubios.wustl.edu
Subject: Re: How to drop null elements of a list?
From: "Richard M. Heiberger" <rmh@temple.edu>
Date: Mon, 23 Aug 2004 10:58:26 -0400
lst <- list(a=c(1:2), b=3:6)

lst.match <- lst[match(c("a","c"), names(lst), 0)] 



Results
> lst
$a:
[1] 1 2

$b:
[1] 3 4 5 6

> lst.match
$a:
[1] 1 2

<Prev in Thread] Current Thread [Next in Thread>