Hi,
I have 2 dataframe. The size of the df_1 is 1272464 bytes (1.2 Mb), 65893 objects, and 3 variables
and df_2 is 3507976 bytes (3.7 Mb), 202732 objects, and 2 variables
.
I am using a function
to sort the columns of the dataframe and then merge
these 2 dataframe. Code is given below
sc <- function(x, i) setNames(cbind(data.frame(t(apply(x[i], 1, sort))), x[-i]), names(x))
res <- merge(sc(df_1, 1:2), sc(df_2, 1:2))
The code is working properly for the demo/small dataframe. But my code is showing Error: cannot allocate vector of size 49.8 Gb
I am not sure, how these 2 small df making 94.8 Gb
. Could you give me any suggestions, please?