[R] logical operations with lists

David Winsemius dwinsemius at comcast.net
Fri Feb 12 23:14:05 CET 2010


On Feb 12, 2010, at 5:06 PM, Zoppoli, Gabriele (NIH/NCI) [G] wrote:

> Sorry, maybe it's easy but I haven't found anything useful:
>
> how can I obtain a list C that contains all the members in the list  
> B that are not in list A? This are lists of nanes, not numbers!

 > A <- list("a", "b" , "c")
 > B <- list("a", "b" , "c", "d")
 > C <- setdiff(A,B)
 > C
list()
 > C <- setdiff(B, A)
 > C
[[1]]
[1] "d"

-- 

David Winsemius, MD
Heritage Laboratories
West Hartford, CT



More information about the R-help mailing list