Re: [R] Big data and column correspondence problem

2011-07-27 Thread murilofm
Daniel, thanks for the help. I finally made it, doing the merging separately. Daniel Malter wrote: > > On a different note: how are you matching if AA has multiple matches in > BB? > About that, all I have to do is check whether, for any of the BB which matches with AA, the indicator equals 1.

Re: [R] Big data and column correspondence problem

2011-07-26 Thread Daniel Malter
If A has more columns than in your example, you could always try to only merge those columns of A with B that are relevant for the merging. You could then cbind the result of the merging back together with the rest of A as long as the merged data preserved the same order as in A. Alternatively, yo

Re: [R] Big data and column correspondence problem

2011-07-26 Thread murilofm
Thanks Daniel, that helped me. Based on your suggestions I built this final code: library(foreign) library(gdata) AA = c(4,4,4,2,2,6,8,9) A1 = c(3,3,11,5,5,7,11,12) A2 = c(3,3,7,3,5,7,11,12) A = cbind(AA, A1, A2) BB = c(2,2,4,6,6) B1 =c(5,11,7,13,NA) B2 =c(4,12,11,NA,NA) B3 =c(12,13,NA,NA

Re: [R] Big data and column correspondence problem

2011-07-26 Thread Daniel Malter
This is much clearer. So here is what I think you want to do. In theory and practice: Theory: Check if AA[i] is in BB If AA[i] is in BB, then take the row where BB[j] == AA[i] and check whether A1 and A2 are in B1 to B3. Is that right? Only if both are, you want the indicator to take 1. Here i

Re: [R] Big data and column correspondence problem

2011-07-26 Thread Petr PIKAL
Hi > Re: [R] Big data and column correspondence problem > > Daniel, thanks for the answer. > I will try to make myself i little bit clearer. Doing step by step I would > have (using a loop trough the lines of 'A'): I am not sure if you are successful in your clarifying

Re: [R] Big data and column correspondence problem

2011-07-26 Thread murilofm
Daniel, thanks for the answer. I will try to make myself i little bit clearer. Doing step by step I would have (using a loop trough the lines of 'A'): 1. AA[1] is 4. As so, I would have to compare A1[1] = 20 and A2[1] =3 with B1 B2 B3 B[3,2:4] 7 11 NA beacause BB[3]=4. Since there is

Re: [R] Big data and column correspondence problem

2011-07-26 Thread Daniel Malter
For question (a), do: which(AA%in%BB) Question (b) is very ambiguous to me. It makes little sense for your example because all values of BB are in AA. Therefore I am wondering whether you meant in question (a) that you want to find all values in BB that are in AA. That's not the same thing. I am

[R] Big data and column correspondence problem

2011-07-25 Thread murilofm
Greetings, I've been struggling for some time with a problem concerning a big database that i have to deal with. I'll try to exemplify my problem since the database is really big. Suppose I have the following data: AA = c(4,4,4,2,2,6,8,9) A1 = c(3,3,5,5,5,7,11,12) A2 = c(3,3,5,5,5,7,11,12) A = cb