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
wrote:
> Dear List,
>
> I have a data structure like:
>
>> aa
> [[1]]
> [1] 1 2 3
>
> [[2]]
> [1] 4
Hi
you have something wrong in your R session, works for me.
> aa<-list(c(1:3), c(4:6))
> aa
[[1]]
[1] 1 2 3
[[2]]
[1] 4 5 6
> bb<-list(3,5)
> bb
[[1]]
[1] 3
[[2]]
[1] 5
> lapply(aa, setdiff, bb)
[[1]]
[1] 1 2
[[2]]
[1] 4 6
Regards
Petr
> -Original Message-
> From: r-help-boun...@
2 matches
Mail list logo