Skip to content
Back to formatted view

Raw Message

Message-ID: <CAEy8Jr12eyq3AKtyjFpR1zhvkz2nGLvvz1VzGJCcnq2NNkeCmg@mail.gmail.com>
Date: 2013-02-01T10:16:20Z
From: Simone Gabbriellini
Subject: 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]]
[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 "aa" back as result. Could you please point me in the
right direction about the combination of functions that I need to
accomplish this task?

Best regards,
Simone

-- 
Simone Gabbriellini, PhD

PostDoc at DISI, University of Bologna
mobile: +39 340 39 75 626
email: simone.gabbriellini at unibo.it
home: www.digitaldust.it

DigitalBrains srl
Amministratore
mobile: +39 340 39 75 626
email: simone.gabbriellini at digitalbrains.it
home: www.digitalbrains.it