Dear List,
I have a data structure like:
aa
[[1]]
[1] 1 2 3
[[2]]
[1] 4 5 6
bb
[[1]]
[1] 3
[[2]]
[1] 5
I would like to set differences between aa and bb and get as
result another list of lists like:
res
[[1]]
[1] 1 2
[[2]]
[1] 4 6
I am trying:
lapply(aa, setdiff, bb)
but I simply get
-project.org [mailto:r-help-bounces@r-
project.org] On Behalf Of Simone Gabbriellini
Sent: Friday, February 01, 2013 11:16 AM
To: r-help@r-project.org
Subject: [R] how to setdiff on lists of lists
Dear List,
I have a data structure like:
aa
[[1]]
[1] 1 2 3
[[2]]
[1] 4 5 6
bb
[[1
You can also try 'mapply'
aa-list(c(1:3), c(4:6))
bb-list(3,5)
mapply(setdiff, aa, bb)
[,1] [,2]
[1,]14
[2,]26
On Fri, Feb 1, 2013 at 5:16 AM, Simone Gabbriellini
simone.gabbriell...@gmail.com wrote:
Dear List,
I have a data structure like:
aa
[[1]]
[1] 1 2 3
3 matches
Mail list logo