Inner Join - Allocate vector to R

Asked

Viewed 201 times

0

I am trying to make an inner_join between two tables by a common "state code" column. However, it is giving an error of "allocate vector of size 1.4 Gb".

Code:

arquivo_antigo_filtrado<- arquivo_antigo %>% select(codigo_estado,PV, PP, PSD, PSCF)
colnames(arquivo_antigo_filtrado) = c("codigo_estado","pv_antigo", "pp_antigo", "psd_antigo", "pscf_antigo")
arquivo_atual_validado<-inner_join(arquivo_atual,arquivo_antigo_filtrado,by="codigo_estado")

Dataset:

inserir a descrição da imagem aqui

Error:

inserir a descrição da imagem aqui

  • 1

    Your computer is not able to separate all this memory space to make this operation you want.

  • 1

    codigo_estado Are there repeated values? That R expects the values to be unique, if they are not they are repeated in all possible combinations, which is what may be causing the creation of this huge vector

  • And since both data frame have the same number of lines maybe what you want is dlpyr::bind_cols or cbind

  • It will not always be the same number of lines, it may vary, only the first that has to be equal.

  • If arquivo_antigo comes from a file and if you no longer need it, rmova it from globalenv, rm(arquivo_antigo) to free memory. After that, it’s not a bad idea to run gc().

  • @Jorgemendes makes total sense, I didn’t realize it. Have some idea of how to solve?

  • @Theorp Look, here’s analyzing your Jay and see if you don’t need to put another variable as conditions or remove the lines from one of the data frames. That since Join operates in the logic of sql it expects the keys used for the condition to be unique, there is to look at your data and see how to fit it.

Show 2 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.