Bethesda MD
>
> Work: 301-451-8575
> Mobile: 301-204-5642
> Email: zoppo...@mail.nih.gov
> ________
> From: jbreic...@gmail.com [jbreic...@gmail.com] On Behalf Of Jonathan
> [jonsle...@gmail.com]
> Sent: Friday, February 12, 2010 5:21 PM
>
"
c<-setdiff(b,a)# all those in B but not A
> c
[1] "d" "e"
cheers
iain
--- On Fri, 12/2/10, Zoppoli, Gabriele (NIH/NCI) [G]
wrote:
> From: Zoppoli, Gabriele (NIH/NCI) [G]
> Subject: Re: [R] logical operations with lists
> To: "r-help@r-project.org&
, LMP, NCI, NIH, Bethesda MD
Work: 301-451-8575
Mobile: 301-204-5642
Email: zoppo...@mail.nih.gov
From: jbreic...@gmail.com [jbreic...@gmail.com] On Behalf Of Jonathan
[jonsle...@gmail.com]
Sent: Friday, February 12, 2010 5:21 PM
To: Zoppoli, Gabriele (NI
sorry, misread your post
try this...
> c<-setdiff(a,b)
> c
[[1]]
[1] "a"
[[2]]
[1] "b"
for a list C that contains all the members in
the list B that are not in list A
--- On Fri, 12/2/10, Zoppoli, Gabriele (NIH/NCI) [G]
wrote:
> From: Zoppoli, Gabriele (NIH/NCI) [G]
> Subject: [R] logical
This is probably not the best way, but (assuming you had vectors and
not lists, since I'm not sure what your list looks like):
C <- B[which(B %in% A ==FALSE)]
Regards,
Jonathan
On Fri, Feb 12, 2010 at 5:06 PM, Zoppoli, Gabriele (NIH/NCI) [G]
wrote:
> Sorry, maybe it's easy but I haven't found
> a<-list('a', 'b', 'c')
> b<-list('c', 'd', 'e')
> c<-intersect(a,b)
> c
[[1]]
[1] "c"
Is this what you want?
Cheers
Iain
--- On Fri, 12/2/10, Zoppoli, Gabriele (NIH/NCI) [G]
wrote:
> From: Zoppoli, Gabriele (NIH/NCI) [G]
> Subject: [R] logical operations with lists
> To: "r-help@r-project
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")
>
7 matches
Mail list logo