Cannot allocate vector on a 33k row table merge table

71 views Asked by At

I'm trying to merge the demographics table ("df_zip_demographics") from the choroplethrZip library with another table including with information by Zip codes.

The table I'm trying to add to the "df_zip_demographics" is a simple two column table, "Stores", where the columns are "ZipCode" and "Hit". When I run this:

demo = df_zip_demographics
foo=merge(Stores, demo[ ,c("region")])

I get

Error: cannot allocate vector of size 4.9 Gb

This is a 33k row operation so I find it very odd. What is the problem here?

1

There are 1 answers

0
marc1s On BEST ANSWER

If the zip code information is in column ZipCode for table Stores and in region for table demo, what you need is

foo=merge(Stores, demo, by.x = 'ZipCode', by.y = 'region')

Hope it helps