[R] how to setdiff on lists of lists

2013-02-01 Thread Simone Gabbriellini
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

Re: [R] how to setdiff on lists of lists

2013-02-01 Thread PIKAL Petr
-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

Re: [R] how to setdiff on lists of lists

2013-02-01 Thread jim holtman
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