[R] Comparing vectors from lists
jim holtman
jholtman at gmail.com
Tue Sep 29 17:48:33 CEST 2009
something like this should work (not exactly sure what you mean by 'compare')
result <- lapply(List1, function(.lst1){
lapply(List2, function(.lst2, .lst1){
all(.lst2 %in% .lst1)
}, .lst1 = .lst1)
})
On Tue, Sep 29, 2009 at 10:34 AM, Christina Rodemeyer
<christinarodemeyer at yahoo.de> wrote:
> Hi guys,
>
> I still did not solve my problem properly! I have to compare the values of two lists of 250 numbers as a result of using the ?by function!
> List1 of 250
> $ 0 : num [1:28] 22 11 31...
> $ 1 : num [1:15] 12 14 9 ...
> ..
> ..
> ..
> - attr(*, "dim")= int 250
> - attr(*, "dimnames")=List of 1
>
> List2 of 250
> $ 0 : num [1:24] 20 12 22...
> $ 1 : num [1:17] 11 12 19 ...
> ..
> ..
> ..
> - attr(*, "dim")= int 250
> - attr(*, "dimnames")=List of 1
>
> So I want to compare each vector of 250 from list1 with all other 250 vectors in list2! Is this doable (list1$0 with list2$0, list2$1 ASO)?
>
> Thank you in advance,
> Christina
>
>
>
>
>
>
>
>
>
> [[alternative HTML version deleted]]
>
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>
--
Jim Holtman
Cincinnati, OH
+1 513 646 9390
What is the problem that you are trying to solve?
More information about the R-help
mailing list