[R] problem in merging

jim holtman jholtman at gmail.com
Mon Feb 7 19:06:56 CET 2011


simple example of what I was talking about; dataframe only size 5 but
result is length 44

> x1 <- data.frame(a=sample(c("A", "B"), 5, TRUE), b=1:10)
> x2 <- data.frame(a=sample(c("A", "B"), 5, TRUE), b=1:10)
> x1
   a  b
1  A  1
2  B  2
3  A  3
4  A  4
5  B  5
6  A  6
7  B  7
8  A  8
9  A  9
10 B 10
> x2
   a  b
1  B  1
2  B  2
3  B  3
4  B  4
5  A  5
6  B  6
7  B  7
8  B  8
9  B  9
10 A 10
> merge(x1, x2, by = 'a', all=TRUE)
   a b.x b.y
1  A   1   5
2  A   1  10
3  A   6   5
4  A   6  10
5  A   3   5
6  A   3  10
7  A   4   5
8  A   4  10
9  A   9   5
10 A   9  10
11 A   8   5
12 A   8  10
13 B   2   3
14 B   2   4
15 B   2   1
16 B   2   2
17 B   2   7
18 B   2   8
19 B   2   9
20 B   2   6
21 B   7   3
22 B   7   4
23 B   7   1
24 B   7   2
25 B   7   7
26 B   7   8
27 B   7   9
28 B   7   6
29 B   5   3
30 B   5   4
31 B   5   1
32 B   5   2
33 B   5   7
34 B   5   8
35 B   5   9
36 B   5   6
37 B  10   3
38 B  10   4
39 B  10   1
40 B  10   2
41 B  10   7
42 B  10   8
43 B  10   9
44 B  10   6
>


On Mon, Feb 7, 2011 at 11:05 AM, taby gathoni <tabieg at yahoo.com> wrote:
>
> Hi all,
>
> I am having this error while trying to merge about 2 dataframes
> m_merge = merge(m_accts,m_op, by.y="CUST_ID",by.x="FORACID",all.y=TRUE,all.x=TRUE)
> Error: cannot allocate vector of size 10.0 Mb
>
>
> Taby
>
>
>
>
>
>
>
>
>
>
>
>
>        [[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
Data Munger Guru

What is the problem that you are trying to solve?



More information about the R-help mailing list